The 26-year-old Rakitic will help fill the void left by the exit of Cesc Fabregas to Chelsea as Barcelona overhauls its squad following its first season without a major trophy in six years.
Both clubs announced the deal on Monday but did not disclose financial details. Sevilla got Barcelona youth player Denis Suarez on a two-year loan.
As team captain, Rakitic helped Sevilla win the Europa League this season. He scored 32 goals in 149 games for the Andalusian side after arriving from Schalke 04.
Rakitic is in the Croatia squad at the World Cup in Brazil.