The no-frills airline had promoted anger among passengers for the charge, when they were introduced.
However the 40 euro (£34) charge was challenged in Barcelona. In Britain the charge is £40.
Judge Barbara Maria Cordoba Ardao, sitting at Commercial Court Number One in Barcelona, ruled the company was breaking international law by imposing the levy.
She ruled that responsibility for printing the boarding pass had always rested with the airline.