Thousands marched through downtown Boston Wednesday night, waving signs and chanting anti-Trump slogans to protest the election of Republican Donald J. Trump as the nation’s next president.

The crowd, which seemed to swell with every step from Beacon Hill to Copley Square, held signs that read “Love Trumps Hate,” “Trump is racism,” and “Impeach Trump.” They chanted expletive-filled slogans in opposition to the billionaire businessman’s victory.

That rallying cry was quickly taken over by a similar chant but against Vice President-elect Mike Pence. Quickly, that gave way to, “Donald Trump, go away. Racist, sexist, anti-gay.”

The protesters, organized by Boston affiliates of Socialist Students, Movement for the 99%, and Socialist Alternative, eventually gathered at Boston Common, filling in the grassy area around the Parkman Bandstand.

One speaker teared up as she described working for an hourly wage of $11. She was buoyed by chants of “We’re with you” from the crowd.

Other chants were more combative, including one mantra supporting people of color and immigrants.

“When black lives are under attack, what do we do?”

“Stand up, fight back!” the crowd roared in unison.

The chant continued. “When immigrant lives are under attack, what do we do? Stand up, fight back!”

As protesters competed with the noise of helicopters flying overhead, a large group of Boston police officers on bicycles kept watch over the demonstration.

Officer James Kenneally, a Boston police spokesman, said the rally drew about 4,000.

In New York, protesters marched on Fifth Avenue from Union Square to Trump Tower, yelling “Trump’s not my president,’’ shutting off traffic on the thoroughfare.

“It is a rallying cry for a movement to stop the damage,’’ said Ian Stearns, a protester.

In Oregon, about 300 people marched through downtown Portland, burning American flags and chanting. About 100 protesters in Seattle gathered in the Capitol Hill neighborhood, blocking roads and setting a trash bin on fire.

In Pennsylvania, hundreds of University of Pittsburgh students marched through the streets, with some in the crowd calling for unity.

Word of the Boston protest spread quickly on social media. Earlier Wednesday, nearly 5,000 people said on Facebook that they would attend the “Boston Against Trump” rally.

“We need to immediately start fighting against him,” the event’s summary said. “We need to build a movement to fight racism, sexism, and Islamophobia!”

Andy Moxley, an organizer with Socialist Alternative, said the groups planned the event as soon as Trump won.

“We’re really, of course, not only shocked by the result of the presidential election, but also people are extremely worried,” Moxley said.

Trump’s stunning victory capped a controversial campaign in which he infuriated critics with remarks about women, Mexican immigrants, Muslims, and others.

But he was more conciliatory during his victory speech early Wednesday morning, telling his detractors, “I’m reaching out to you. It is time for us to come together as one united people. It’s time.”

Clinton sounded a similar note during her concession speech hours later, telling devastated supporters, “We owe [Trump] an open mind and the chance to lead.”