The final phase of qualifying was halted, with only Piastri and Haas' Nico Hulkenberg having set times, when Sainz slammed backwards into the barriers at the final corner as he prepared to start his flying lap.
The win was a first for Ferrari in Mexico since 1990 and fourth of Carlos Sainz's career.
Red Bull's Max Verstappen dealt Lando Norris a shattering blow in their Formula One title battle by winning a wet and chaotic Sao Paulo Grand Prix from 17th on the grid.
Lando Norris roared to his second successive pole position, and third in four races, in a McLaren front row sweep with team mate Oscar Piastri
The pole was the 26th of Charles Leclerc's career, and third of the season.
Lewis Hamilton shed pent-up tears of joy after ending a 945-day wait for a win with a record ninth British Grand Prix victory in front of his home fans on Sunday.
Red Bull's Verstappen, who had been on pole at Zandvoort every year since the circuit returned in 2021 and has yet to be beaten there, will still line up alongside the Briton on the front row.
George Russell led Lewis Hamilton in a Mercedes front-row lockout in qualifying for the British Grand Prix on Saturday with McLaren's Lando Norris completing a rare one-two-three of home drivers.
Max Verstappen claimed his sixth victory from nine races this season and the 60th of his Formula One career.
Max Verstappen held off a late charge by McLaren's Lando Norris to win the Emilia Romagna Grand Prix
Red Bull's Formula One World champion Max Verstappen took pole position for the Australian Grand Prix on Saturday with Carlos Sainz qualifying alongside on the front row for Ferrari two weeks after undergoing surgery for appendicitis.
World champion Max Verstappen got back to winning ways on Sunday with a third straight pole-to-flag victory at the Japanese Formula One Grand Prix, leading teammate Sergio Perez across the line for a Red Bull 1-2 at Suzuka.
Leclerc took pole in Monaco in 2021, but did not start the race due to a driveshaft failure, and 2022 when he ended up fourth.
Red Bull make changes to car after discussions with FIA
Ferrari's Carlos Sainz won the Australian Grand Prix on Sunday in a triumphant return two weeks after appendicitis surgery as Red Bull's World champion Max Verstappen suffered his first retirement in two years.
Formula One leader Max Verstappen celebrated a record-equalling ninth successive victory on Sunday after beating the rain to win a chaotic and red-flagged Dutch Grand Prix for the third year in a row.
It was the first time Verstappen, winner of a record 19 of 22 races last year, has won the first two races of a season. He has also won 19 of the last 20.
Max Verstappen leads Red Bull front row sweep in Bahrain
Red Bull's triple Formula One world champion Max Verstappen won a US Grand Prix sprint race from pole position on Saturday after an early challenge from Mercedes's Lewis Hamilton.
Max Verstappen took his fifth pole position in a row at the British Grand Prix.
Carlos Sainz lapped Monza's "Temple of Speed" with a fastest time of one minute 20.294 seconds, 0.013 quicker than Max Verstappen's final flying lap.
Charles Leclerc swept to pole position for the Mexico City Formula One Grand Prix on Saturday with Carlos Sainz qualifying second in a surprise Ferrari front-row lockout.
Max Verstappen celebrated a record 10th win in a row by leading Red Bull team mate Sergio Perez one-two at Ferrari's home Italian Grand Prix
Max Verstappen put Red Bull on pole position for his home Dutch Grand Prix at Zandvoort for the third year in a row
Formula One leader Max Verstappen won the British Grand Prix on Sunday as Red Bull stayed unbeaten in 2023 and equalled McLaren's 1988 record run of 11 victories in a row.
Max Verstappen became the first Formula One driver to take 16 victories in a season
Max Verstappen took the 50th win of his Formula One career, and record-equalling 15th of the season
Max Verstappen added his name to the list of triple Formula One World champions on Saturday after Red Bull team mate and sole title rival Sergio Perez crashed out of the Qatar Grand Prix sprint race.
Max Verstappen won Red Bull's home Austrian Grand Prix from pole position and with the fastest lap on Sunday for the team's 10th successive Formula One victory and ninth in nine races this season.
As impressive as those results have been, Red Bull team principal Christian Horner took the opportunity after the race to issue a scary warning that his team is capable of winning every grand prix this season.
Max Verstappen won the season opener as Red Bull registered a dream start with a one-two finish at the Bahrain GP.
Max Verstappen took pole position on Saturday in a wet qualifying for a Canadian Grand Prix
Red Bull-backed Thai racer Alex Albon will return to Formula One next season as a Williams driver alongside Canadian Nicholas Latifi, the British-based former champions announced on Wednesday.
Carlos Sainz put Ferrari on pole position for the US Formula One Grand Prix in Austin, Texas, on Saturday, with Red Bull's double World champion Max Verstappen joining the Spaniard on the front row.
Ferrari's Charles Leclerc will line up alongside on the front row after a final qualifying session that ended with Verstappen's Mexican team mate Sergio Perez crashing at the final corner.
Max Verstappen clinched his second win of the season as the Australian Grand Prix was halted with three red flags.
Verstappen struggled for grip through qualifying but it all came together in his last effort
Max Verstappen dashed Ferrari's home hopes and won the Italian Grand Prix
IMAGES from the Belgian F1 Grand Prix
Leclerc had seized the lead at the start, and held it through an initial safety car period, before Verstappen made up for his poor getaway and passed the Monegasque -- whose tyres were fading fast -- with a late move around the outside.