Ferrari
For the 1987 season, Berger signed for Ferrari, partnering the Italian Michele Alboreto and replacing Stefan Johansson. After mechanical failures robbed him of the chance to perform, Berger came on strongly in the latter half of 1987, winning the final two rounds of the season. The 1987 Ferrari F1/87 benefitted from the work of ex-McLaren designer John Barnard although the car was designed by Austrian Gustav Brunner. Ferrari were back competing for race honours for the first time since mid-1985 from the Hungarian Grand Prix onwards. Berger was running a close second to Nigel Mansell at the Hungaroring before he was forced to retire. At Estoril for the Portuguese Grand Prix, Berger dominated the race from pole position before spinning in the latter stages to finish second after pressure from Alain Prost. The Austrian then looked to be heading for a second consecutive victory at the Hermanos Rodriguez circuit for the Mexican Grand Prix as he once again dominated the race but mechanical problems forced him to retire when leading. Success at both Suzuka and Adelaide for the Japanese and the Australian Grands Prix, including pole positions in both events and the fastest lap in Adelaide, ensured Ferrari and Berger went into the winter season with boosted confidence and both team and driver were tipped as favourites for the 1988 Championship. As he had done to Fabi in 1986, Berger out-qualified teammate Alboreto 12–4 in 1987. Berger's wins also gave Ferrari its first back to back victories since the late Gilles Villeneuve won the Monaco and Spanish Grands Prix in 1981.
In 1988, the McLaren team, with twice World Champion Alain Prost and the sensationally fast Ayrton Senna dominated the season, winning 15 of the 16 rounds. The Honda V6 turbo engine in the McLaren MP4/4, and Lotus's 100T had superior fuel efficiency to the Ferrari, which caused both Berger and Alboreto to often drive much slower than possible in races. Berger was the only driver to break the McLaren stranglehold in 1988, winning the Italian Grand Prix after Senna tangled with Jean-Louis Schlesser, who had temporarily replaced Nigel Mansell (who was sick with chicken pox) in the Williams-Judd. Alboreto made it a Ferrari 1–2, finishing only half a second behind the Austrian. This was a particularly poignant victory for the team, as it came just weeks after the death of Enzo Ferrari. Berger was also the only non-McLaren to take pole in 1988 when he sat on pole for the British Grand Prix at Silverstone. It was also the only race where both Ferrari cars were on the front row, with Alboreto qualifying only 0.199 behind his teammate.
The Ferrari F1/87/88C proved troublesome for both Berger and teammate Alboreto especially in terms of fuel consumption from the 1.5 litre turbo engine (Ferrari, unlike the Japanese, had not built a new engine for the season to cope with the lower fuel limit of 150 litres and the lower 2.5 Bar turbo limit, instead fronting with an updated version of their 1987 engine). At the very wet British Grand Prix for instance, Berger led the opening laps from Senna having already attained pole position, consequently building a large cushion over the rest of the field before having to slow just to finish (at the halfway mark he was in second place, 50 seconds in front of 3rd placed Nigel Mansell). Ultimately he finished in ninth position, having fallen from fifth after running out of fuel coming out of the Woodcote chicane on the last lap, with Alboreto already having run out of fuel 3 laps from the finish. In the space of 200 metres, Berger was passed by Nelson Piquet (Lotus), Derek Warwick and Eddie Cheever (Arrows) and Riccardo Patrese (Williams). Both Ferrari drivers were often forced to use the lowest turbo boost setting they had (approximately 2.0 bar) and reduce their engine's revs in order to get the cars to the finish of a race. Until changes were made to the Ferrari's V6 engine late in the season, this meant that Berger and Alboreto were often vulnerable to attack from the leading atmospheric cars, with Berger estimating that he could often only use 550 bhp (410 kW; 558 PS) of the car's available 650 bhp (485 kW; 659 PS) during a race if he wanted to finish.
Berger was leading the final race of the season at Adelaide ahead of Prost and Senna before he clashed with former Ferrari driver René Arnoux in the Ligier while trying to lap the Frenchman. Before the race Berger, apparently with the full support of the team, told the McLaren drivers who qualified 1–2 in front of him that he was going to go all out and run as fast as he could without worrying about running out of fuel to give a good show for the fans. He did just that and after passing Senna for second on lap 3, he set numerous fastest laps before finally catching and passing Prost on lap 14. From there, he put some five seconds between himself and Prost before being taken out by Arnoux on lap 28. Berger out-qualified Alboreto in all 16 events for the 1988 Formula One calendar and in the eight races where they were both classified as finishers, finished behind Alboreto only once in France, spelling the end for the Italian after five seasons with the Maranello outfit.
For 1989, Berger was joined at Ferrari by Nigel Mansell. The Ferrari 640 with its V12 engine was fast but fragile, thanks in part to its revolutionary semi-automatic gearbox designed by John Barnard. At the Brazilian Grand Prix, Berger tangled with Senna at the first corner as the Brazilian found himself trapped between Riccardo Patrese's Williams-Renault to the left and Berger's Ferrari to the right, with the three drivers dicing for the lead. Berger was lucky to escape alive from a crash during the San Marino Grand Prix at Imola's Tamburello corner, where he went straight on into the wall at almost 180 mph (290 km/h). The car spun multiple times along the wall before catching fire. It took 16 seconds for a rescue crew to reach the Ferrari and put the fire out. Suffering remarkably few injuries, notably burns to his hands and some broken ribs, Berger was able to make it back to the cockpit at the Mexican Grand Prix after missing just the Monaco Grand Prix. Berger attributed this to Ferrari's unique semi-automatic paddle-shift gearbox, saying that his return would have been delayed if Ferrari still used the traditional gear stick transmission used in all other F1 cars in 1989.
With the exception of the Australian Grand Prix where both Ferrari drivers had poor qualifying sessions, Berger featured in the top four in qualifying and races in all of the remaining Grands Prix but poor reliability and accidents meant that he only finished three races all year (by mid-season the problem with the semi-automatic transmission was found to be not enough power from the battery which was fixed with the help of team sponsor, electrical experts Magneti Marelli). His first points of the year didn't come until he finished in second place in Round 12 at the Italian Grand Prix. He won the next race in Portugal which was overshadowed by the accident involving Mansell and Senna, and then finished second at the next race in Spain. These races were in fact his only points scored for the year but was still enough to give him 7th in the championship after being third in 1988. The improvement in form from Ferrari came too late though. At the British Grand Prix it was announced that Alain Prost would leave McLaren at the end of the season to join the Scuderia while Berger decided to sign for McLaren who, with their Honda V10 engines, was at the time the best and fastest team in Grand Prix racing.