HOCKENHEIM, Germany (AP) -- Lewis Hamilton beat teammate Nico Rosberg to the fastest time in the second practice session at the German Grand Prix as Mercedes set the pace on Friday.
Hamilton completed his best lap on the Hockenheimring in 1 minute, 18.341 seconds, edging Rosberg by 0.024 seconds.
''A pretty good day today,'' Hamilton said.
Rosberg had been leading but he went off track on the second turn and his teammate then topped the leaderboard on supersoft tires for the first time.
Red Bull's Daniel Ricciardo was third, 0.078 behind Rosberg, followed by Ferrari's Kimi Raikkonen and McLaren's Kevin Magnussen.
''It's tomorrow when we'll see how close we really are,'' Ricciardo said of his team's challenge. ''I think we had a good car today and we extracted pretty much everything we could out of the practice.''
Felipe Massa of Williams and Jensen Button of McLaren were sixth and seventh, respectively, followed by Red Bull's Sebastian Vettel, Ferrari's Fernando Alonso, Williams' Valtteri Bottas, Sauber's Adrian Sutil, and Toro Rosso's Daniil Kvyat, who was within half a second of Raikkonen in fourth.
Track temperatures hit an astonishing 58 degrees C (136 F) at one stage during the afternoon session. Rosberg's brakes were smoking as he waited for Hamilton's tires to be changed.
''We had a bit of a situation in the pit lane when my teammate came in suddenly just before I was called in too,'' Rosberg said. ''But the boys reacted quickly and cooled my car and brought his tires out.''
The forecast is for more of the same temperatures on Saturday, while rain and summer storms could arrive on Sunday.
''The heat was a challenge, particularly in the car, but that's how I like it,'' Hamilton said. ''We need to analyze as much as we can tonight.''
Mercedes also finished 1-2 in the opening practice, with Rosberg beating Hamilton by 0.065.
Rosberg leads his British teammate by just four points going into Sunday's race at the halfway stage of the season.
Red Bull is not far off the pace, however. Both Ricciardo and Vettel posted very similar lap times to Hamilton on their respective longer runs in the afternoon.
''I think we are maybe a bit closer than previous weekends, but it is close between us, Ferrari and Williams as well,'' Vettel said.
Caterham endured a frustrating afternoon. Marcus Ericsson stopped on the track early in the session before teammate Kamui Kobayashi had to pull up with smoke coming from his bodywork.
Kobayashi jumped out of the cockpit and ran across the track for an extinguisher, before running back to put out the fire with the aid of marshals.
''It looks like it was a fuel leak that started the fire but we need more time tonight to find out exactly why that happened and then fix it,'' Kobayashi said. The Japanese driver reported problems with his brakes before that.
Earlier, turns 1 and 8 proved the most problematic on a morning of minor errors. Alonso was among a number of drivers to run off the track at the eighth turn.
''Today, we concentrated on setup to try and adapt to the temperatures, which are going to be extremely high all weekend. I had no problems with either the soft or supersoft compounds,'' the Spaniard said.
The drivers had to adjust to the removal of the front and rear interconnected suspension from their cars after FIA said the system could be illegal. All teams opted to remove the system rather than run the risk of docked points.