The frontman has joined the Portuguese club initially on a loan deal until the end of the season, when the deal will then be processed permanently for €8m.
Ruiz will sign a five-year contract for the Europa League club and Barça will hold a buyback clause on the player for three years, while he has a €45m release clause.
In a separate deal that was completed on the same day, Braga forward Francisco Trincao will join the Catalan club in a €31m deal this summer.
The 21-year-old had been hoping to break into the Barcelona senior squad this season but has remained in the B team, despite a number of injuries in the first-team.
Luis Suàrez and Ousmane Dembélé been ruled out until the end of the season, with youngsters Ansu Fati and Carles Perez instead promoted in their place - but the latter has since been sold to Roma.