Barcelona beat Sporting Gijon 6-1 on Wednesday and coach Luis Enrique announced after the game he would quit at the end of the season.
Real Madrid could only draw at home to Las Palmas later on Wednesday. so Barcelona stay top having played one more game than their rivals.
But it was their 46-year-old coach’s decision to quit that stunned everyone at the Camp Nou.
He closed his post-match press conference saying: "I will finish this press conference in a different way; I want to announce I will not be continuing as Barcelona coach.
“I want to thank the club for all the faith they have shown in me. These have been three unforgettable years.
“You don't get a lot of rest in this job and I need to rest.
"Hopefully we have three very exciting months left and if the stars align we can come back in the Champions League, and if not we still have the league and the cup.”
The search will now begin for his successor, with Athletic Bilbao coach Ernesto Valverde and Sevilla coach Jorge Sampaoli tipped as favourites.
He admitted to having given his players the news after their six-goal demolition of Sporting.
Lionel Messi opened the scoring on nine minutes and Juan Rodriguez put through his own goal two minutes later from Luis Suarez’ shot.
Suarez grabbed the third with a thumping volley on 27 minutes after Carlos Castro had pulled a goal back for the visitors.
The Barcelona coach was able to take Suarez off at half-time and substitute Paco Alcacer grabbed a goal for himself just two minutes after the restart.
Messi was taken off on the hour but it did nothing to help Sporting who conceded the fifth on 66 minutes from a Neymar free-kick.
Ivan Rakitic made it six with three minutes left.
Their stay at the top was expected to be brief but the second surprise of the night came when Real Madrid dropped two points.
They took the lead on eight minutes through Isco but Pedro Tanausu leveled just two minutes later.
They were then reduced to 10-men when Gareth Bale was shown a second yellow card for kicking out at Jonathan Vieira.
The same player then scored a penalty after Sergio Ramos handled in the area on 56 minutes.
When Kevin Boateng made it 3-1 three minutes later there looked no way back for Real Madrid but Cristiano Ronaldo had other ideas.
He scored from the penalty spot after Dani Castellano had handled.
He then headed in James Rodriguez’ cross with a minute left but there was no time for Madrid to get the winner.
The draw leaves them a point behind Barcelona with a game on hand.
Elsewhere Villarreal beat Osasuna 4-1,Celta Vigo drew 2-2 with Espanyol and Granada beat Alaves 2-1.