Raikkonen's Lotus team-mate Romain Grosjean was seventh and Ferrari's Felipe Massa 10th.
Di Resta benefited from his decision to fit intermediate tyres at the start of final qualifying as rain began to fall, whereas all the big teams started the session on dry-weather tyres.
The Scot went fastest as the other drivers came in to change their dry-weather 'slick' tyres and as the track was soaked it appeared the decision would pay off.
But the rain then stopped and in the final minutes of the session the front-runners all improved - although Alonso did not manage to cross the line in time to do a lap when the track was at its driest following an earlier spin.
Hamilton was the last driver to cross the line and do a fast lap and it paid off as he beat Vettel by 0.188 seconds.
The German crossed the line just behind team-mate Webber and beat the Australian by 0.125secs.
Di Resta said he had expected the rain to stay but was pleased to equal his career-best qualifying position.
Englishman Max Chilton achieved a career-best qualifying position of 16th after his Marussia team and rivals Caterham chose to fit dry-weather tyres in the final moments of the first knock-out session while everyone else was on intermediate tyres.
Hamilton delighted with Belgian pole
The decision enabled Caterham's Giedo van der Garde to achieve a stunning third place in the first session behind Ferrari's Alonso and Mercedes' Hamilton.
The Dutchman secured 14th place on the grid in the drier conditions of the second session, just ahead of the two Marussia of Jules Bianchi and Chilton, who was impressively just 0.199secs slower than his highly rated French team-mate.
Failing to put on slick tyres cost the two Toro Rosso drivers places in the second session.
Jean-Eric Vergne and Daniel Ricciardo, who is expected to move to Red Bull next season, will line up 18th and 19th.
Williams's Valtteri Bottas, Sauber's Esteban Gutierrez and Caterham's Charles Pic brought up the rear.
Sunday 25 August: Race coverage at 12:10 BST on BBC One & BBC Red Button at 13:00 BST, Radio 5 live, plus live text commentary online. F1 Forum, 15:15 Connected TV. Highlights, 19:00 BBC Three & BBC Red Button
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.