Ferrari's seven-times world champion Michael Schumacher, gunning for his third pole in a row in what some fans fear could be his last appearance on home soil, had to settle for second place on the starting grid.
Renault's world champion Fernando Alonso, winner at Hockenheim last year and 17 points clear of Schumacher in the championship with seven races remaining, qualified a distant seventh.
The Spaniard, celebrating his 25th birthday, almost collided with his 37-year-old German rival in the pit lane in the heat of the battle.
Raikkonen's pole was McLaren's first since Colombian Juan Pablo Montoya, now absent after deciding to switch to the U.S.-based NASCAR series, in Belgium in September last year.
"It was nice to get pole. We had some difficulties but it's the best place to start and let's see what happens tomorrow," said the Finn, who has not won a race since the thriller in Japan last October.
"The tyres have been very good all weekend," he added. "We found something new for the car at the last test which seems to help. The car is better now."
In his five starts at the southern circuit, Raikkonen has failed to finish despite leading in both the last two appearances there.
MASSA THIRD Brazilian Felipe Massa qualified third for Ferrari with Briton Jenson Button, out of the points for the past five races, alongside for Honda and Renault's Italian Giancarlo Fisichella behind in fifth.
"We are quite happy to have a strong opponent with us and having Alonso where he is right now," said Schumacher, who was 0.135 seconds slower but remains well placed to chase a hat-trick of wins on Sunday.
"That's obviously a good starting point.
"I exited the pit lane and once I was out I saw that Fernando was pretty close to me," Schumacher said of the incident. "I wasn't aware that he was there, because there were so many people, so much mess and it was so tight.
"If he felt there was some problem for him, then I'm sorry for that. But that's the way it goes sometimes."
While Raikkonen filled the top slot, despite running wide on to the gravel on his final flying lap, Spanish team mate Pedro de la Rosa was ninth after colliding with Toyota's Ralf Schumacher at the hairpin. Ralf qualified eighth.
The first part of the knockout session was red-flagged after five minutes when Toro Rosso's American Scott Speed ran wide, spun and hit the wall.
Toyota's unlucky Italian Jarno Trulli will start at the back of the grid, after qualifying 13th, because of an unscheduled engine change in practice that cost him 10 places.
More from rediff