Lewis Hamilton was close to pulling out of Saturday's qualifying for the German Grand Prix because of illness, but recovered to grab his record-increasing 87th career pole.
The five-time world champion said had a sore throat when he woke up on Saturday and told the team he was not feeling well.
Reserve driver Esteban Ocon was put on stand by.
"I wasn't feeling good this morning. I have a sore throat so we prepped, just in case I would not be able to do the session," said Hamilton.
"We were prepared to put our second (reserve) driver in the car in the worst-case scenario, but I got through good."
Ferrari have an illness that needs a cure, says Mercedes boss
Hamilton's fifth pole of the season was his first at Hockenheim since 2008.
"It was a relatively straightforward session, very clean. The team did a great job in terms of timings and getting us out at the right times," he told reporters.
"We saw both Ferraris drop out. Obviously that made it a little bit different in terms of the battle that we had at the end.
"Nevertheless, I think I had pretty good pace and it would have been close between myself and (Ferrari driver Charles) Leclerc. They've been quick all weekend.
"The Ferrari car seemed to be working really well, so I imagine it would have been really, really close between us at the front."
Hamilton says British crowd gave him 'energy' for record win
Hamilton added that he was mindful of the changing weather conditions and was therefore wary of making any forecasts for Sunday's race.
"There's a real threat of rain," he said. "I've not looked at the long-runs so I don't know how strong we are in them, but it's not the easiest of tracks to overtake.
"It's going to be a real challenge just making sure we do all our procedures to make sure we operate at the level we've been operating today."