Hamilton, who had led a McLaren one-two in the morning, went top of the timesheets moments before rain hit halfway through the 90-minute session.
It was only predicted to be a few drops, but turned out to be a heavy shower lasting around 13 minutes.
Hamilton's dry time was a minute 21.995 seconds, compared with his 1:22.821 from the morning. He will take heart from his pace on the opening day of the weekend - the last one before the annual summer break - as he seeks to close the gap to the Ferrari and Red Bull drivers.
The Lotus of Raikkonen ended the session second fastest, 0.185s off the pace and ahead of Bruno Senna (+0.258) of Williams, the Ferraris of Massa (+0.422) and Alonso (+0.587) and Hamilton's team-mate Jenson Button (+0.752).
World champion Sebastian Vettel (+0.829) was eighth, while his Red Bull team-mate Mark Webber, second in the standings ahead of the German but 34 points behind Alonso, was down in 14th.
Seven-times champion Michael Schumacher, who was 10th behind Romain Grosjean when the weather ended anyone's chances of improving, crashed his Mercedes into the turn 11 barriers while trying out intermediate tyres once the rain had stopped.
He was travelling relatively slowly when the car slid sideways, and as such was not hurt and the F1 W03 avoided extensive damage.
Although much of the track dried quickly, the final half hour of the run-out was largely useless as teams were forced to choose between full wet tyres - which deteriorated rapidly on the dry tarmac - and inters, which were dangerous on the section where Schumacher crashed, featuring several puddles.
Grosjean himself took the front wing off his Lotus in a crash after leading the times in the early part of the session.
Briton Paul Di Resta impressed with seventh spot in the Force India.