The 2008 world champion, the last man across the line on a drying track after running the gamut of Spa's fickle weather, will be joined on the front row by Red Bull's championship leader Sebastian Vettel.
Australian Mark Webber, preparing for the final Belgian Grand Prix of his career, qualified third for Red Bull with Mercedes' Nico Rosberg fourth. Ferrari's title contender Fernando Alonso could qualify only ninth.
Vettel is 38 points clear of Lotus's Kimi Raikkonen at the top of the standings with nine races remaining but Hamilton, a further 10 adrift, showed why many believe he is the German's biggest rival.
The Briton had not figured in the top 10 in any of the three practice sessions and scraped into the final phase of qualifying in 10th place by just 0.21 of a second and with his hopes of success looking forlorn.
Hamilton celebrated his 31st career pole with a wild whoop of delight over the radio and seemed as surprised as anyone after crossing the line with a fastest time of two minutes 01.012 seconds compared to Vettel's 2:01.200.
"I went wide in Turn One and my dashboard told me I was three seconds down and then it was four seconds and then six so I didn't know what was going on but I kept pushing," he told reporters at the post-qualifying news conference.
"It's a blessing I am up here. Generally I feel comfortable in changing conditions. I can find the limit and I pushed through the middle sector and really caned it."
Team principal Ross Brawn let out a sigh of relief. "We were just on the limit of being the last car. It did work out for us and with the track drying, Lewis did a great job. He really is settling in well to the team," he told the BBC.
Before that it had looked as if Hamilton's compatriot, Force India driver Paul di Resta, was heading for the first pole of his career after making an inspired call on the Pirelli tyres.
While the nine others queued up at the pit lane exit on slicks at the start of the third phase, the Scot waited and went out on intermediate tyres.
He soon had the track to himself as the rest pitted to change tyres and managed to get in a lap before the rain began to fall.
The weather eased towards the end of the session, allowing others to go faster. Di Resta ended up a still creditable fifth on the grid ahead of compatriot Jenson Button in the McLaren and the Lotus pairing of Romain Grosjean and Raikkonen.
"I thought the rain was going to stay. It was quite a ballsy decision by myself. I saw umbrellas coming up so I made the right choice," said Di Resta.
"I think it was the right time but our car is not that quick in the wet. It was unfortunate, but P5 is not so bad. In the dry, we're looking good for the race. If it's wet, I'd be a bit more nervous."
The notoriously capricious Spa climate made merry with the pecking order in the first part of qualifying with Caterham's Dutch driver Giedo van der Garde, who usually brings up the rear, ending up as third fastest.
Both Marussias, perennial back-markers, made it through to the second phase while both Williams and Toro Rosso drivers, including Australian Daniel Ricciardo who is tipped to graduate to Red Bull next season, missed the cut.
"As far as I am aware, we went out with the second set of intermediates too early. We should have waited but I trust the guys in the pit to make the best call. I am disappointed but tomorrow's another day," said Ricciardo.