The Austrian Grand Prix was won by Charles Leclerc, who passed Max Verstappen three times.
Carlos Sainz had an engine failure with 14 laps to go and was on the verge of making it a one-two for the Maranello team.
Verstappen came back at Leclerc but he held on.
Verstappen had a 38 point lead over Leclerc.
He moved back ahead of Red Bull'sSergio Perez.
After starting eighth for Mercedes, Lewis Hamilton finished third for the third time in a row. George Russell finished fourth.
The end of the race was more difficult for Leclerc than it had looked like, as for the first time since the Australian Grand Prix back in April the Ferraris had stronger race pace than Verstappen's Red Bull.
The gearbox refused to make some shifts because of the initial problem, as the stuck throttle was also affecting the car.
Despite expressing concern over the radio, Leclerc was able to manage the problem and take his first win after a long time.
He has faced a brutal run of results, including two engine failures and two victories lost to strategy errors, as well as a start from the back, allowing Verstappen to build a significant advantage.
This was the most convincing result for two months and their pace in the race will increase their confidence that they can come back at the Dutch over the remainder of the season.
After the race, Leclerc exhaled deeply and said "Yes." I agree. I was afraid. I was afraid.
He said that he needed that one. The last five races have been incredibly difficult for me but also for the team and to finally show we have the pace in the car and can do it was incredibly important.
On a track where Red Bull have been so strong in recent seasons, it was a bit of a surprise that Ferrari was so fast.
Leclerc overtook Verstappen on the inside of Turn Three on the 10th lap after starting from the pole position.
Red Bull decided to switch to a two-stop strategy as Verstappen was about to make his first pit stop.
As the race went on, it became apparent that the cars were too fast.
13 laps later than Verstappen, Leclerc went to the pits. Just nine laps later, he passed the Red Bull - with relative ease - and was soon closing in.
After Verstappen stopped for a second time three laps after losing the lead, Leclerc made a second stop, which was 13 laps after Verstappen.
He overtook Verstappen for the lead four laps later.
Verstappen was left to try to hold off Sainz, who was two seconds behind the Red Bull, when his engine failed on the 57th lap.
Verstappen was able to cut his loss to Leclerc to the absolute minimum despite his weakest race of the season, because of the reliability concerns for Ferrari.
Hamilton bided his time in the early laps but made up ground by staying out as others were triggered into pit stops by Verstappen's early stop.
Soon, the seven-time champion was running in clear air, and when Sainz's Ferrari had made its first stop, he had only Esteban Ocon's Alpine ahead to seal the fourth place that became third.
Ocon was fifth, followed by Lando Norris' McLaren, Kevin Magnussen's McLaren, and Mick Schumacher's Haas.
After starting from the back of the grid, Fernando Alonso made a late second stop for medium tyres and fought past Alex Albon's Williams and Valtteri Bottas to take the final point.
There's more to come.