Charles Leclerc recovered from a crash early in the day to top the times for Ferrari ahead of Red Bull's Sergio Perez in Friday's second free practice on a day of incidents and accidents at the Azerbaijan Grand Prix.
Leclerc, who has taken pole three times before on the tricky Baku street circuit, had gone off early in opening practice, hitting the barriers at Turn 15 and his car incurring damage to the front right section.
He was unhurt and the Ferrari mechanics fixed the damage although he needed to pit early in the second practice to fit a new power steering system.
This produced the odd sight of the Ferrari team forming a wall of bodies – like a team defending a football free-kick – to block the vision of Leclerc's car as it was repaired.
He returned to clock a best lap in one minute and 43.484 seconds to outpace Perez, a two-time winner in Baku, by 0.006 seconds with seven-time champion Lewis Hamilton third for Mercedes, 0.066 off the pace.
Carlos Sainz was fourth in the second Ferrari ahead of McLaren's Oscar Piastri and three-time champion and series leader Max Verstappen, who was quickest in opening practice, in the second Red Bull.
His title rival Lando Norris struggled for a clear lap and was only 17th in the second McLaren, his best lap undone when he came upon Pierre Gasly's Alpine and had to abort.
"I'm sorry," said Gasly. "I had a problem with the battery."
Lance Stroll was seventh for Aston Martin ahead of Haas's Nico Hulkenberg and George Russell in the second Mercedes, who had an inter-session engine change.
Behind them in tenth came young Briton Ollie Bearman in the second Haas.
The 19-year-old, who finished seventh on his F1 debut for Ferrari in Saudi Arabia as a replacement for Sainz, is racing in Baku in place of the suspended Kevin Magnussen whose seat he will take full-time next season.
After an overcast opening session, second practice began in warm conditions which continued to cause problems for the drivers.
Leclerc reported steering problems, following an escape road excursion, and Sainz skimmed the barriers while Verstappen slid to a halt at Turn Five to avoid hitting a wall, later complaining about visibility problems with the setting sun.
Russell was detained at Mercedes as the team changed his engine. When he rejoined the session he was soon recalled to the pits due to an unidentified issue.