Barca were good value for their victory, even without club captain Lionel Messi pulling the strings in the final third, as Luis Suarez grabbed a hat-trick in between strikes from Philippe Coutinho and Arturo Vidal .
Marcelo made the scoreline 2-1 just after half-time, but a late flurry from the hosts made sure of the three points, which has left Madrid sitting ninth in the Liga table, seven points behind leaders Barca.
Lopetegui has been under pressure for weeks now and, having won just one of their last seven matches in all competitions, the board has finally decided to act by terminating his contract.
The 52-year-old boss was appointed as Madrid's new manager just before the World Cup back in June, which cost him his position as Spain's head coach for the tournament.
Los Blancos started the season quite strongly but, after a 1-0 defeat against Alaves on October 6, things began to unravel for Lopetegui and his team have underperformed ever since.
Goal understands Antonio Conte is in advanced talks to replace him in the hotseat, though difficulties regarding the Italian's release clause with Chelsea have provided an unwelcome setback.
As such, reserve-team manager Santiago Solari is set to take the reins until an agreement can be reached between the two clubs.
A statement released by Madrid on Monday reads: "The board of directors of Real Madrid CF, after meeting today on October 29, 2018, have agreed to terminate Julen Lopetegui's contract with the club.
"The decision, taken with the highest level of responsibility, aims to change the dynamics of the first team while all the objectives of this season are still achievable.
"The board of directors understands that there is a great disproportion between the quality of the staff of Real Madrid - which has eight players nominated for the next Ballon d'Or, something unprecedented in the history of the club - and the results obtained to date.
"The club thanks Julen Lopetegui and all his technical team for their effort and work and wish them the best in their professional career.
"He will provisionally replaced by Santiago Solari, who will lead the first team starting from Tuesday."
Lopetegui had pledged to turn things around at the Bernabeu in the wake of El Clasico, as he insisted: "This is a tough blow, but I am strong enough to know everything can be turned around. There is a long way to go, and I have a lot of faith in this group of players.”
However, Madrid chiefs were unwilling to grant him a stay of execution at the club and, by turning to Conte at this early stage, they are hoping that the season can be salvaged, with plenty still to play for across all competitions.
Club captain Sergio Ramos was pensive in his response when asked about Lopetegui's future on Sunday, as he stated post-match: "It is not our decision. So, we will stay to the side, let the hours pass and whatever happens will happen. It’s not about the players.”