Hamilton left it to his final flying lap to edge his Williams rival by more than half a second for what appeared to be his third pole position of the season and McLaren's 150th overall.
But McLaren ordered the British driver to stop his car after crossing the line because of a technical glitch, with the team subsequently claiming their driver had insufficient fuel to return to the pits.
Governing body FIA ruled that "as the amount of the fuel put into its car is under complete control of (McLaren) the stewards cannot accept this" and Hamilton was "excluded" from qualifying results, allowed to start from last place instead.
"We told him to stop because we knew there was a problem," said team principal Martin Whitmarsh, who claimed earlier that Hamilton had had enough fuel left in the car for the mandatory sample. The rule was implemented following a similar problem with Hamilton's car at the 2010 Canadian Grand Prix.
The decision gave Williams its first pole since the 2010 Brazilian GP and made Maldonado the first Venezuelan driver to start a race first in F1.
Maldonado's lap of 1 minute, 22.285 seconds — which was half a second slower than Hamilton's — became the benchmark, promoting Fernando Alonso of Ferrari to the front two, while Lotus pair Romain Grosjean and Kimi Raikkonen were also in great position to earn the team its first victory of the season by filling out the second row.
"I'll do my best," Maldonado, the first Venezuelan F1 driver in nearly 30 years, said before learning of the decision. "I'm a fighter."
With 10 of the last 11 winners at the Catalunya Circuit coming from pole, Sunday's 66-lap race is shaping up to be another unpredictable one with tires shaping much of the strategy in qualifying. A Maldonado victory would make it a fifth straight different winner to open the season, which would make this the most varied start to a season since 1983.
Mexican driver Sergio Perez of Sauber was elevated to fifth in front of Chinese GP winner Nico Rosberg of Mercedes, while F1 points leader and two-time defending champion Sebastian Vettel starts seventh after opting to save his tires and failing to set a qualifying time.
"Hopefully we capitalize on this starting position we are in tomorrow," said Alonso, who could provide his home fans with a second victory here and first since 2006. "We must score points tomorrow. Aggressive start tomorrow (yes) — crazy start, no."
After four races, Hamilton trails Vettel by four points following three straight third-place finishes. Mark Webber of Red Bull is five points behind his teammate, and Jenson Button of McLaren and Alonso trail Vettel by 10 points.
Mercedes driver Michael Schumacher decided against competing in the third session while Kamui Kobayashi of Sauber was sidelined by an oil leak to complete the original top 10, which Button snuck into after his teammate's exclusion.
Leading teams Red Bull and McLaren certainly struggled on Saturday. Button had been fastest in practice on Friday while Webber, who won pole here the past two years for Red Bull, starts 11th.
"It's a big surprise," said Vettel, who set the fastest lap after three practice sessions earlier Saturday. "We had decent pace in the morning but it seemed to vanish. We didn't have the pace to go for pole position."
Felipe Massa's poor start continued, the Brazilian finished a season-worst 17th for Ferrari. The team is buoyed by Alonso's best starting position of the campaign, however.
Whitmarsh admitted changes had been made in McLaren's garage following a number of glitches in pit stop strategy this season.
"Lewis and his team did a great job, so it was a massive margin by the situation within F1 at the moment, so undoubtedly he deserves to be there," Whitmarsh said of Hamilton's lap time, which was over half a second quicker than Maldonado's.