Under the deal, Barcelona have the right to buy back the player for 13 million euros at the end of the 2012/13 season.
If Roma decides to block any repurchase, the cost to them would jump to 40 million euros, the club said in a statement on its website.
The deal was announced a day after the Spanish and European champions reached an accord with Italian club Udinese to buy Chilean striker Alexis Sanchez for 26 million euros. The 22-year-old will sign a five-year contract on Monday.
Krkic was born in Spain to a Serbian father, who was a professional footballer with Red Star Belgrade, and a Catalan mother.
He made his debut in Barcelona's first team in the 2006-2007 season when he was just 16, and last December signed an extension on his contract until 2015.
A star for Spain's under-21 squad, he made his debut for the senior team in a World Cup qualifier against Armenia in 2008.
But under Barca coach Pep Guardiola, he has failed to find a regular first-team place alongside the likes of Argentine star Lionel Messi and Spain's David Villa.
"I am 20 years old and I want to continue showing what I was not able to do here because I was not given enough time" on the pitch, Krkic told a news conference Friday.
"My dream was to triumph with Barca, but I am very happy that another club has given me the chance to continue succeeding."
He also welcomed the buyback clause.
"I'm going from one big club to another and all parties have an interest. That makes me happy. I consider myself privileged."
Guardiola had said on Tuesday that his priority for the upcoming season was signing a forward, with Alexis Sanchez his top target.
The club starts a pre-season tour of the United States with a friendly against Manchester United in Landover, Maryland on July 30.
The Spanish league kicks off on August 21, when Barcelona visit Malaga.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional