The player has five days to appeal, according to Agence France-Presse.
Neymar sued Barcelona shortly after his move to Paris Saint-Germain in 2017, claiming he was owed €43.6 million in bonus money.
The Blaugrana responded with a countersuit against the Brazilian, requesting he return the €14 million he had already received for renewing his contract with the club in 2016, along with an additional €8.5 million in damages.
"FC Barcelona expresses its satisfaction with the verdict announced today by Social Court 15 in Barcelona in relation to the lawsuit involving FC Barcelona and the player Neymar Jr. regarding the amount of the signing bonus in the final renewal of the player's contract," the club said in a statement.
The 28-year-old joined Barcelona in 2013 from Santos in a contentious deal. One of Barcelona's own members filed a lawsuit against then-club president Sandro Rosell, claiming he had hidden the true cost of Neymar's transfer.
Despite the court battle, rumors continue to link Neymar with a potential return to Camp Nou.