The 34-year-old’s deal also has the option of a third year.
Messi left Barca – the only club he has played for – as they were unable to afford a new deal under La Liga’s financial fair play rules.
“I am impatient to start a new chapter of my career in Paris. The club and its vision are in perfect harmony with my ambitions,” said the Argentina star.
“I know how talented the players and staff are here. I am determined to build, alongside them, something great for the club and for the fans. I can’t wait to set foot on the Parc des Princes pitch.”
PSG president Nasser al-Khelaifi said: “I am delighted that Lionel Messi has chosen to join Paris St-Germain and we are proud to welcome him to Paris, with his family.
“He did not hide his desire to continue to evolve at the highest level and to win trophies. The ambition of the club is of course identical.
“The addition of Leo to our world-class team confirms the relevance and success of our recruitment. Together with our great coach and his staff, I look forward to seeing our team make history for all of our supporters around the world.”
Considered one of the greatest players of all time, Messi scored a record 672 goals in 778 games for Barca, the club he joined as a 13-year-old.
The striker has won the Ballon d’Or a record six times and lifted 35 trophies with the Catalan club.
He becomes PSG’s fourth free-transfer signing this summer after the arrivals of Netherlands midfielder Georginio Wijnaldum, Spain defender Sergio Ramos and Italy goalkeeper Gianluigi Donnarumma.
Highly rated Morocco right-back Achraf Hakimi also joined from Inter Milan.
Messi, who will wear the number 30 shirt, will play in a front three alongside the two most expensive players of all time – Neymar and Kylian Mbappe.
A PSG news conference will take place in the auditorium of the Parc des Princes on Wednesday at 10:00 BST.
Messi could make his PSG debut at home to Strasbourg on Saturday.