The 24-year-old attacking midfielder makes the switch from La Liga after featuring in all three of his country's group stage matches at the World Cup in Brazil.
Brahimi, whose deal includes a release clause of €50m, began his senior career with Rennes in Ligue 1 before moving to Granada in 2013.
He is one of a host of new signings made by Julen Lopetegui ahead of his first full season in charge of the club.
Lopetegui was confirmed as Paulo Fonseca's long-term replacement in May and has brought in the likes of Adrian, Bruno Martins Indi and Casemiro in recent weeks.
Having finished third in the Primeira Liga last season, Brahimi will be tasked with helping Porto challenge Benfica and Sporting Lisbon for the title.
Porto finished 13 points off the pace last term as they missed out on a fourth consecutive league crown.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.