The crowd roared and jumped up and down as the clock in the 18th century Real Casa de Correos -- the seat of the regional government of Madrid -- struck midnight, even though the new year only starts 24 hours later.
Many followed a Spanish New Year's custom and gobbled a grape on each of the 12 chimes at midnight for 12 months of good luck while others counted the clangs of the clock out loud.
Some used French fries or chocolate-covered peanuts instead of grapes.
City officials test the chimes the day before New Year's Eve to make sure they are working properly and each year a growing sea of people come for the trial run to start celebrating early.
Many said they came to avoid the much larger crowd that turns out on New Year's Eve for the countdown in the square, watched live by millions of people across Spain on television.
"Tomorrow it would be impossible to come down here -- there would be too many people," said Fatima Rodriguez de Ahumada, a 33-year old secretary who came with her husband and sister.
"We are going to spend New Year's Eve at home and we will watch it all on television. This way we get a taste of what it is like."
Dozens of police frisked revellers as they entered the square and searched rucksacks to prevent glass bottles from being brought in while several ambulances stood by.
With the temperature falling to minus two degrees Celsius (28 Fahrenheit), groups of people -- many wearing colourful wigs or oversize plastic glasses -- huddled together to keep warm and ate snacks as they waited for the clock to strike midnight.
"This is mad, I can't imagine this many people turning out for something like this in London. No way," said Claire Brown, a 23-year-old student from Britain who was visiting a friend in Madrid for the holidays, as a young man set off a firecracker nearby.
A smaller crowd of several hundred people, including many couples with young children, turned out for an earlier test of the chimes held at noon on Tuesday.