In other matches, super-sub Messi helped Barca romp past Atletico
Cristiano Ronaldo hit five goals in a 6-0 romp at Espanyol to become Real Madrid's record La Liga scorer on Saturday.
Real have seven points in second place after Ronaldo, who like great rival Messi had drawn a blank in the opening two games, ended his early-season drought in emphatic style.
The Portugal captain turned in a blistering performance that took his tally in Spain's top flight to 230, overtaking former Real striker Raul's total of 228.
The 30-year-old FIFA Ballon d'Or winner scored in the seventh, 17th (penalty), 20th, 61st and 81st minutes while Karim Benzema struck in the 28th as Real put a hapless Espanyol to the sword.
Ronaldo, who hit five against Granada in La Liga last season, raced clear and finished calmly to set Real on their way before converting a penalty won by Gareth Bale.
Bale's centre from the left set up Ronaldo to volley in his third, equalling Messi's Spanish record of 32 hat-tricks, before he turned provider by crossing for Benzema to make it 4-0 inside half an hour.
Wales playmaker Bale set Ronaldo up again after a swift counter attack and substitute Lucas Vazquez made the assist for the former Manchester United man's fifth and Real's sixth.
"They (Espanyol) have a good team but when Cristiano has his day it's impossible," said Real's Portugal defender Pepe.
Later, Lionel Messi came off the bench to earn Barcelona a 2-1 victory at Atletico Madrid.
Champions Barca, who started with talisman Messi as a substitute following the birth of his second son on Friday, fell behind after a tight first half at the Calderon when Fernando Torres sped clear to score in the 51st minute.
Neymar levelled four minutes later when he curled a sumptuous free kick into the top corner and the Brazil forward should have made it 2-1 in the 67th when his point-blank shot was cleared off the line by Diego Godin.
Neymar was also involved in the winner before the ball fell to Luis Suarez, who had struck the crossbar in the first half, and he slipped a pass into space for Messi to dink it past goalkeeper Jan Oblak with 13 minutes remaining.
The victory preserved Barca's perfect start to the season and they lead on a maximum nine points from three matches, three ahead of 2013-14 champions Atletico who are fifth.
"We played very well after going behind and we’re very happy," Neymar told Spanish television.
"Messi is the best player in the world and when he comes on to the pitch everyone plays better."
Spain forward Paco Alcacer scored in added time to give Valencia an unconvincing 1-0 triumph at promoted Sporting Gijon, a first win of the campaign lifting them to sixth place on five points.
Five-goal Ronaldo becomes record Real scorer in La Liga
The Real truth behind De Gea not making it to Madrid
Euro qualifiers, PHOTOS: Germany put Scots on the rocks; Portugal win
Man City flex muscles as English clubs break spending record
La Liga PHOTOS: Real hand Betis a 5-0 thrashing while Barca labour to victory