Gathered in the central square, the protesters carried posters reading "Justice" and "We are not all here" -- in reference to victims of violence who have lost their lives.
Municipal officials estimated at least 40,000 people had rallied in Madrid, and smaller protests were held in Barcelona and other cities.
"Gender violence must end, equality must be attained and the 'glass ceiling' for women in business broken," Marta Garcia, a protester at the Madrid rally, told AFP.
But Garcia said she was pleased to see the number of men taking part in the demonstration.
Manuela Carmena, the city's mayor, released a video message together with the mayor of Barcelona Ada Colau, advocating to an end to violence against women.
In the last three months of 2016 there were 38,402 reports of domestic violence, marking a 14 percent increase compared to the previous year, according to figures provided by a watchdog group.
Elsewhere in Europe and around the world marches were held to mark International Women's Day, with rallies taking place in Istanbul, Ukraine, New York and Buenos Aires.
Here are some pictures from the event in Madrid: