His father, Jorge Messi, was also given a jail term for defrauding Spain of €4.1m (£3.5m; $4.5m) between 2007 and 2009.
They also face millions of euros in fines for using tax havens in Belize and Uruguay to conceal earnings from image rights.
However, neither man is expected to serve time in jail.
Under the Spanish system, prison terms of under two years can be served under probation.
The footballer and his father were found guilty of three counts of tax fraud in Wednesday's ruling by the court in Barcelona.
As well as the jail terms, Messi was fined about €2m and his father €1.5m. They made a voluntary €5m "corrective payment", equal to the alleged unpaid tax plus interest, in August 2013.
The sentence can be appealed against via the Spanish supreme court.
During the trial, Lionel Messi insisted he "knew nothing" about the management of his financial affairs, saying his father dealt with them while he was "playing football".
For his part, Jorge Messi claimed he did not have enough knowledge to orchestrate such a fraud, blaming his tax consultants instead.
Lionel Messi retired from international football late last month. He has won the Fifa World Player of the Year five times and is one of the richest athletes in the world.