He will miss the rest of the season with Barça and will also be unavailable for Euro 2024 with Spain next summer, with the tournament due to begin on June 14 in Germany.
"Gavi has undergone a successful operation on his torn right knee anterior cruciate ligament plus a meniscus suture," Barça confirmed in a short statement.
"Supervised by the club's medical services, the doctor Joan Carles Monllau performed the intervention at Hospital de Barcelona."
Barça coach Xavi Hernández said last week that Gavi, who won the European Golden Boy award in 2022, is irreplaceable due to his "heart, passion and courage."
Gavi had been a regular for Barça and Spain this season, only missing two games -- both for his club -- through suspension.
In total, he has made 111 appearances for Barça and, since he made his debut as a 17-year-old in August 2021, no outfield player has played more games for the club.
Barça returned to action without Gavi with a 1-1 draw at Rayo Vallecano on Saturday and face FC Porto in the UEFA Champions League on Tuesday, knowing that a win will book their spot in the round of 16 for the first time since 2021.
Goalkeeper Ter Stegen has been ruled out with a back problem, though, as Barça prepare for a huge week which will end with the visit of Atlético Madrid in LaLiga on Sunday.
After winning just two of their last five games in all competitions, the pressure is mounting on Xavi, but the Barça boss insists he feels completely backed by the club.