Acting on an appeal by the Hips Don't Lie singer, the court ordered the Treasury to reimburse her with over 60 million euros ($A98 million), including interest, Shakira's defence said.
The judge ruled authorities had failed to prove Shakira spent more than 183 days in Spain in 2011, as required by Spanish law to be considered a tax resident in the country.
At the time, the tax agency had argued Shakira was linked to Spain through her relationship with former FC Barcelona footballer Gerard Pique and had her centre of activities in the Mediterranean country.
But the High Court ruled the fines were unlawful as they were "based on the assumption that the appellant's tax residence was in Spain for the 2011 fiscal year, a fact which has not been proven".
The new ruling can still be appealed before the Supreme Court and does not affect tax years after 2011.
"This decision comes after an eight-year ordeal that has taken an unacceptable toll, reflecting a lack of rigour in administrative practice," Shakira's lawyer, Jose Luis Prada, said in a statement.
The same statement quoted Shakira as saying she hoped the ruling would set a precedent for "thousands of ordinary citizens who are abused and crushed every day by a system that presumes them guilty and forces them to prove their innocence while facing financial and emotional ruin."
In November 2023, Shakira reached a deal with prosecutors to avoid a trial in Barcelona over charges she failed to pay 14.5 million euros in Spanish income tax between 2012 and 2014.
As part of the agreement, she accepted the charges and a fine of half the amount owed - more than 7.3 million euros.