Under the shadow of a huge Spanish flag that flies above the central Colon Square, the demonstrators waved their own smaller red and yellow versions of the same banner and held signs reading “Stop Sanchez. Elections now!”.
Municipal police estimated some 45,000 people had taken part in the protest, which comes just two days before the high-profile trial of Catalan separatist leaders opens in Madrid under the national and foreign spotlight.
The rally was called by centre-right Ciudadanos, the conservative Popular Party (PP) and far-right Vox, which has only recently burst onto Spain's political scene, as well as a handful of smaller far-right groups.
They are angered by Sanchez's decision to take a more conciliatory tone with pro-independence parties, whose votes are crucial to the legislative agenda of his eight-month-old minority government.
“The government of Sanchez's time is up,” PP head Pablo Casado told reporters before the start of the rally.
Sanchez came to power in June with the support of Catalan nationalist parties, which voted with him in a no confidence motion against former Prime Minister Mariano Rajoy, whose PP was embroiled in a corruption scandal.
Polls show that between them the PP, Ciudadanos and Vox would win a majority if a general election were held today, giving them the combined parliamentary clout to drive Sanchez from office.
The three parties won a majority in a regional election in the southwestern region of Andalusia in December, ousting the Socialists from power in the region after 36 years.
They called the rally after Sanchez's government last week accepted the presence — as asked by Catalan separatists — of an independent “rapporteur” in future talks between Catalan parties.
The right wing parties accused the government of treachery over the move.
Despite the government's concession, Catalan separatist parties still refuse to back the government's 2019 budget. If Sanchez is unable to approve his budget, he could call elections before his term is over in 2020.