Updated

Lewis Hamilton from Mercedes claimed his fourth consecutive pole after topping Red Bull's Sebastian Vettel in Saturday's rain-soaked qualifying session for the Belgian Grand Prix.

A rain shower moved over the 4.352-mile, 19-turn Spa-Francorchamps circuit at the start of the third and final qualifying segment. Paul di Resta from Force India held the provisional pole when he was the only one of the 10 drivers in the segment that had intermediate tires on his car. Thinking he had secured his first career F1 pole, di Resta returned to the garage late in Q3, just before the rain stopped.

The improving weather conditions allowed the Mercedes and Red Bulls to surpass di Resta's lap time of 2 minutes, 2.332 seconds. The pole lead changed hands repeatedly in the closing seconds, beginning with Mark Webber before his Red Bull teammate, Vettel, moved into first.

Hamilton crossed the line just after Vettel with a lap time of 2:01.012, which gave him the pole.

"I was surprised when I came across line," said Hamilton, who earned his fifth pole of the season and the 31st of his F1 career. "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 seconds. So I didn't know what was going on, but I kept pushing."

Hamilton started on the pole and won the most recent grand prix four weeks ago in Hungary. It was his first victory with Mercedes. He also claimed the pole for the British Grand Prix and German Grand Prix prior to Hungary. Hamilton won the Belgian GP in 2010.

Vettel's lap time was 0.2 seconds behind Hamilton. The three-time defending F1 world champion enters the Belgian GP with a 38-point lead. He won this race in 2011.

"It was a tricky session for all of us," Vettel said. "When I was on the last lap, I didn't know how the conditions were on the other side of the track. It was surprisingly dry when I got there. Then it was easy to make big a improvement in terms of lap time."

Webber qualified third, while Hamilton's teammate, Nico Rosberg, took the fourth spot. Di Resta ended up finishing fifth.

"I thought the rain was going to stay," Di Resta said. "It was unfortunate, but P5 is not so bad."

McLaren's Jenson Button, who won the Belgian GP one year ago, qualified sixth, followed by Lotus drivers Romain Grosjean and Kimi Raikkonen. Fernando Alonso and Felipe Massa from Ferrari struggled in qualifying, with Alonso placing ninth and Massa 10th.