Dani Olmo scored a debut winner just hours after finally being registered for Barcelona as Hansi Flick’s side came from behind to keep up their winning start to La Liga.
Olmo rejoined Barca from RB Leipzig for a reported 60m euros (£51m) earlier this month but could not play because of the Spanish top-flight’s strict financial rules.
But after Ilkay Gundogan was released back to Manchester City, and defender Clement Lenglet moved to Atletico Madrid, the 26-year-old was able to feature at Rayo Vallecano.
And the playmaker found the winner late on, curling in left-footed after great work from fellow Spain Euro 2024 hero Lamine Yamal.
Barca top La Liga after playing three games and are the only side still with a 100% record.
Unai Lopez gave the home side an early lead which they held until the hour mark, when Pedri played a fine one-two with Raphinha and stroked in.
Olmo, who was at Barcelona as a boy but left for Dinamo Zagreb at the age of 16 without making an appearance, then stole the points and the headlines with his fantastic finish.