The ruling comes as a defeat to Margrethe Vestager made tax crackdowns a key feature of her tenure as the competition commissioner.
Apple does not have to pay €13 billion in Irish back taxes, the EU's second-highest court has ruled.
The European Commission ordered that the taxes be returned four years ago, saying that the US tech giant had benefitted from illegal state aid under two Irish tax rulings.
But the EU's General Court on Wednesday ruled in favour of Apple and Ireland, saying in a statement: "The Commission did not succeed in showing to the requisite legal standard that there was an advantage.”
“The Commission was wrong to declare" that Apple “had been granted a selective economic advantage and, by extension, state aid”, it added.
Brussels had ordered Apple to pay for gross underpayment of tax on profits across the European bloc from 2003 to 2014.
It said the California-based firm used two shell companies incorporated in Ireland to reduce its tax burden to well under 1%.
The ruling comes as a defeat to Margrethe Vestager, who made tax crackdowns a key feature of her tenure as the competition commissioner.
"If member states give certain multinational companies tax advantages not available to their rivals, this harms fair competition in the EU," said Vestager, now serving as Executive Vice President in the Von der Leyen Commission, in light of the decision.
"It also deprives the public purse and citizens of funds for much-needed investments – the need for which is even more acute during times of crisis," she added.
The result could also have a weakening effect on other cases in the same arena such as those against Ikea or Nike's deals with the Netherlands.
Ireland appealed the Commission's order with Apple, but many commentators said it stood to lose whatever the outcome.
The €14 billion the country would have received, after interest, if the court backed the Commission could have gone a long way in remedying its finances in the wake of the coronavirus pandemic.
On the flip side, a defeat may have damaged Ireland's chances of attracting new international investment.
Just hours after the ruling in Luxembourg, the Commission was to unveil new plans to combat tax fraud.