Venezuelan Pastor Maldonado took his maiden victory and Williams's first since 2004 in a strategic battle with Ferrari's Fernando Alonso.
Maldonado, who is in only his second season in Formula 1, won the Spanish Grand Prix after his team outsmarted Ferrari with pit-stop timing.
Alonso survived a late charge from Lotus's Kimi Raikkonen, who took third.
McLaren's Lewis Hamilton fought up from the back of the grid to eighth, with team-mate Jenson Button taking ninth.
Alonso's second place moves him into a tie on points at the head of the championship with Sebastian Vettel, who was sixth in his Red Bull, passing Button, then Hamilton and finally Mercedes driver Nico Rosberg in quick succession in the closing laps.
Vettel is classified as the leader on results countback.
Alonso and Ferrari may well privately regret the decision to delay their second pit stop until two laps after Maldonado made his on the 24th of 66 laps.
Alonso, who started second, beat pole-sitter Maldonado into the first corner and led through the first pit-stop period, after which he had a 3.4-second lead on lap 12.
But Maldonado closed that advantage to 1.5secs by lap 21 and when he could not get any closer Williams decided to try to 'undercut' Alonso with an earlier pit stop.
It worked to perfection. Ferrari's decision not to stop on the next lap simply made life easier, especially when Alonso was held up by Marussia's Charles Pic during that period - for which the Frenchman earned a drive-through penalty.
BBC F1 technical analyst Gary Anderson said: "I think Alonso was a lap too late and that has cost them."
That left Maldonado with a 6.2-second lead. Alonso closed in throughout their third stints, getting the gap down to 4.2secs before Maldonado stopped for the final time on lap 41.
Williams had a problem fitting his left rear tyre and that left Alonso only 3.1secs adrift when he rejoined from his final stop three laps later.
The double world champion quickly closed on to the rear of the Williams, but Maldonado drove cleverly to ensure he was always far enough ahead at the start of the pit straight to ensure Alonso could not pass him.
It concludes a remarkable recovery from Williams, who had slumped in recent years to the worst season in their history last year.
But changes to the way the team operates, and key personnel at the top, have produced a turnaround in fortunes.
"It's a wonderful day for the team which has been pushing so hard," Maldonado said.
"We have been trying to improve so much. It was a tough race with the strategy and the tyres after a couple of laps we were struggling after as couple of laps with the rear grip, Fernando did a better start than me, I was just following the pace.
"It was my first podium and my first victory. You can imagine what I feel."
Alonso began to drop away in the final eight laps - he suspected his car had lost an aerodynamic part - and measured his pace to the charging Raikkonen, who was only 0.6secs adrift at the flag.
Alonso said: "We were a little bit unlucky maybe, but they did a great job and they had the pace.
"If we were faster than the Williams we would have had the opportunity to overtake but they were quicker.
"It's a step forward in terms of championship possibilities."
Raikkonen said he was "a bit disappointed", adding: "I expected to be a bit stronger in the race, especially in the beginning. In the end we were quite quick but it was too late."
The Finn's team-mate Romain Grosjean was fourth, ahead of Sauber's Kamui Kobayashi.
Behind Vettel, Nico Rosberg held off a late charge from Hamilton to take seventh, ahead of Button and Force India's Nico Hulkenberg.
Hamilton drove a superb, attacking yet measured race to recover from the penalty that demoted him from pole to the back of the grid.
The 2008 world champion stopped only twice when almost all other drivers opted for three stops, and judged perfectly the tactical demands of needing to look after his tyres while also gaining places quickly.