Neymar's first-half penalty saw holders Barcelona beat Real Sociedad 1-0 in the Copa del Rey on Thursday, ending their curse at the Anoeta.
Barca had failed to win their last eight matches at the Basque venue going into the first leg of this quarter-final tie, with their last victory coming back in 2007.
But that unwanted streak ended after Neymar won and converted the spot-kick himself for what proved to be the only goal of the game.
Barca, seeking a third consecutive Copa crown, are now in a strong position to progress ahead of the second leg at Camp Nou next Thursday.
In LaLiga, only six points separate Barca and La Real, who face a tough task to continue their path towards a first final appearance since 1988.
While the two teams were evenly matched, with neither goalkeeper particularly busy, Barca held on in relative comfort, without Jasper Cillessen having a major save to make.
La Real gave Barca an early scare when Mikel Oyarzabal curled just wide after Samuel Umtiti lost possession, before Neymar - back as one of seven Barca changes - forced the match's first save from Geronimo Rulli at the other end.
It was the visitors, on a high after thumping Las Palmas 5-0 on last Saturday, who struck first, Neymar winning the spot-kick by surging into the box and drawing a clear trip from Aritz Elustondo.
The Brazil forward took it himself and sent Rulli the wrong way in the 21st minute for only his eighth goal of the season.
Asier Illarramendi fired a deflected effort narrowly wide following good work from Willian Jose, but La Real went into the break behind.
Andre Gomes replaced Andres Iniesta at the interval, while Neymar made a poor start to the second half.
First, his lack of control wasted an opportunity to test Rulli after he was sent through on goal, before he collected Messi's flick, cut inside and curled wide from a good shooting opportunity.
Messi - already booked for timewasting - avoided a second yellow when Real played a quick free-kick against him and later survived again despite fouling Raul Navas as Eusebio Sacristan's men chased an equaliser.
But Neymar did receive punishment from referee Jose Luis Gonzalez Gonzalez, who booked him for diving after he went down under Rulli's challenge.
Yuri's cross-shot only just evaded the far post for the hosts, and Illarramendi headed narrowly over, but Cillessen was not seeing much of the action and did not have a second-half save to make.
Rulli was similarly unoccupied, Messi curling a free-kick over, while Nemyar was perhaps fortunate to avoid a second yellow for a high boot on Elustondo as the visitors secured a one-goal advantage.