Vinicius Junior struck a late equaliser for Real Madrid on his 100th appearance for the club in a 1-1 home draw against La Liga rivals Real Sociedad.
The Brazilian substitute salvaged a point for Real Madrid by firing home from close range in the 89th minute after Portu had given the visitors a second-half lead.
But it was not enough for Zinedine Zidane’s side to leapfrog Barcelona into second place and they are five points adrift of leaders and city rivals Atletico Madrid, who have a game in hand.
The hosts dominated the first half and twice hit the woodwork, but could not force that elusive first goal.
Mariano’s close-range header from Lucas Vazquez’s excellent cross and Raphael Varane’s looping header from the subsequent corner both struck the crossbar.
Casemiro flashed a 25-yard shot just wide and Toni Kroos’ effort was blocked after the German had ghosted past two defenders.
Luka Modric then forced Real Sociedad goalkeeper Remiro into a reaction save after the Croatian had nutmegged a defender on the edge of the penalty area.
But Real Sociedad were transformed at the start of the second period and – after forcing three-successive corners – they took the lead through Portu.
Former Manchester City winger David Silva orchestrated the move and from Nacho Monreal’s cross, Portu rose highest to send a superb header in off the woodwork in the 55th minute.
The visitors spurned a chance to extend their lead when Portu failed to pick out the unmarked Alexander Isak in the area.
Casemiro headed Vazquez’s cross narrowly off target and Rodrygo fired wide as Real Madrid chased an equaliser.
The hosts threatened again through Casemiro following substitute Hugo Duro’s cutback and with time running out they finally hauled themselves level.
Federico Valverde’s backheel sent Vazquez free down the wing and Vinicius Junior, a 61st-minute replacement for Isco, finished into the bottom corner.
Real Madrid poured forward in the closing stages, but Real Sociedad held firm to halt the home side’s five-game winning run.