Newark Mayor Cory Booker walks out of a polling booth for the vacant New Jersey seat in the US Senate. Photograph: Julio Cortez/AP

In the seven years that he has been mayor of Newark, New Jersey, Cory Booker, 44, has broken the mould of small-city politics and developed a new style of direct politicking through social media. In the process, he has acquired a nationwide following and reputation and gathered more than 1.4 million Twitter followers – five times as many people as live in Newark.

With such a track record, it is not surprising that Booker won the special election replace the late Frank Lautenberg in the Senate, becoming the first black senator from New Jersey after winning by 56% to 43%.

The deccisive result is partly a reflection of how Booker has used his charismatic personality and media savvy to build extensive name-recognition in his state and throughout the country, and then to convert that renown to his electoral advantage. Over the course of the short special election campaign, which began shortly after Lautenberg’s death in June, he raised more than $11m, and thus far he has outspent Lonegan by a whopping ratio of eight to one. And tellingly, more than half of his funds came from out-of-state donors.

The special election ends at an odd time – a Wednesday in October – because, it is widely assumed, the state’s governor, Republican Chris Christie, didn’t want Booker’s name on the ballot to bring Democratic voters out for the general election in November, when Christie is up for re-election.

Booker recruited his celebrity friends to fundraise and stump for him, headlined by Oprah Winfrey and Facebook’s Mark Zuckerberg, with solid backup from Hollywood figures such as Ben Affleck, Matt Damon and Steven Spielberg, billionaires Ron Burkle and Michael Bloomberg, and a slew of New York tycoons and hedge fund managers.

In addition to the huge head-start he has had in cash and media reach, Booker also gained an advantage when he drew Lonegan as his opponent. Lonegan is a little known right-wing Republican who disapproves of gay marriage and abortion, backs the government shutdown and has strong Tea Party leanings – not a natural draw in the socially progressive state of New Jersey. Still, despite all these favourable conditions, Booker’s march to Washington has not been as smooth as it was supposed to be.

“The reason that the race has been much closer than most people expected it to be is that attacks on Cory Booker over his character and record as mayor have taken hold,” said Patrick Murray, head of the polling institute at Monmouth university.

“Holes were found in his personal story, and questions raised about whether his national ambitions were more important to him than public service.”

Lonegan pressed relentlessly at these perceived weaknesses, calling him a “show pony” and firing off the soundbite: “We need a leader, not a tweeter”. He also ran with speculation that Booker might have exaggerated some of the details of his relationship with Newark residents, including an anecdote the mayor has related on several occasions about a man dying in his arms, and accounts of how he personally helped homeless people in the streets.

But the most substantive issue was an attack launched by the Republicans on Booker's record as mayor of Newark. Booker came to the office partly on a campaign pledge to reduce crime, and for a while he succeeded. But in recent months the rate has been creeping up again.

Statistics gathered by the New Jersey Star-Ledger show that there were 83 homicides in 2003 under the previous mayor, compared with 95 homicides last year. The number of violent crimes has also edged up from 2,848 to 3,220 over the same time period, though the city’s population has remained relatively steady.

Booker now has a year to put some of these doubts behind him before he has to face New Jersey voters in November 2014, when Lautenberg’s term runs out and he will have to run again, in order to secure a full six years of his own. That might mean having to pull back on habits that have defined him so far: his tendency to seek the spotlight; his outreach to every individual voter with a gripe or a burning house; even his use of social media.

“I think he’s going to have to learn to be a little more circumspect with social media in the Senate,” Murray said. “That’s not so much because of the missteps he made in this election – it’s more that if he continues to try and grab the limelight he’s going to find there are 99 other senators who think they are in the line in front of him.”