Venezuelan Pastor Maldonado will start Sunday's Spanish Grand Prix on pole position for Williams after Lewis Hamilton was sent to the back of the grid because McLaren failed to put enough fuel in his car.
The four race stewards excluded Britain's 2008 world champion from Saturday's qualifying results at the Circuit de Catalunya but allowed him to start from 24th and last place.
Without the most basic human error so far in a season full of pitlane blunders, McLaren would have been celebrating their 150th pole in Formula One.
Instead, the sensational and surprisingly harsh decision - announced four and a half hours after the track action had finished - handed former champions Williams their first pole since 2010 and only their second in six years.
It also promoted Ferrari's local favourite Fernando Alonso to the front row for his home race at a circuit where the winner has started in the top two on 20 of 21 occasions and he can count on near-total support from the crowd."It's a great moment for the team and for me. And it's the best present ever for Frank Williams," declared Maldonado, who had earlier attended a 'surprise' 70th birthday bash in the paddock for his team founder.
"I hope to have a great race tomorrow. I'll do my best, we'll see. We have everything and I think the team must be ready for all the situations in the race," he said of his first pole position and first by a Venezuelan.
Hamilton had been told his car had a problem and was ordered to stop immediately by the team on his slowing down lap after the chequered flag, which the Briton did, rather than drive back to the pit lane.
The governing International Automobile Federation (FIA) said McLaren had breached the technical regulations. "A team member had put an insufficient quantity of fuel into the car thereby resulting in the car having to be stopped on the circuit in order to be able to provide the required amount for sampling purposes," a statement said.
"As the amount of fuel put into the car is under the complete control of the competitor the stewards cannot accept this as a case of force majeure... the competitor is however allowed to start the race from the back of the grid."
McLaren team boss said Hamilton's car had about 1.3 litres of fuel left in it when stopped. The rules say the car must have a litre remaining once back at the pits for a sample to be extracted. Hamilton, runner-up in Barcelona last year, had described his pole lap as "one of the best I've ever had" immediately after the session.
Red Bull's double world champion and series leader Sebastian Vettel moved up to seventh place, even though he did not set a lap time in the final session.