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.
FC Barcelona's reaction
"FC Barcelona expresses its full support to Leo Messi and his father in relation to the conviction for tax fraud...
"The club... considers that the player, who has corrected his position with the Spanish tax office, is in no way criminally responsible with regards to the facts underlined in this case."