With 85 percent of precincts reporting, Booker had 55 percent of the vote to Lonegan's nearly 44 percent. The first reaction from the social-media savvy victor came, of course, on Twitter: "Thank you so much, New Jersey, I'm proud to be your Senator-elect."
Booker, 44, will become the first black senator from New Jersey and heads to Washington with an unusual political resume. He was raised in suburban Harington Park as the son of two of the first black IBM executives, and graduated from Stanford and law school at Yale with a stint in between as a Rhodes Scholar before moving to one of Newark's toughest neighborhoods with the intent of doing good.
He's been an unconventional politician, a vegetarian with a Twitter following of 1.4 million - or five times the population of the city he governs.
With dwindling state funding, he has used private fundraising, including a $100 million pledge from Facebook founder Mark Zuckerberg, to run programs in Newark, a strategy that has brought his city resources and him both fame and criticism.
Booker was elected to complete the 15 months remaining on the term of Frank Lautenberg, whose death in June at age 89 gave rise to an unusual and abbreviated campaign. If he wants to keep the seat for a full six-year term - and all indications are that he does - Booker will be on the ballot again in November 2014.
Gov. Chris Christie, a Republican with a national following of his own, appointed his attorney general, Jeffrey Chiesa, to the Senate temporarily and scheduled a special election for a Wednesday just 20 days before Christie himself is on the ballot seeking re-election. Christie said he wanted to give voters a say as soon as legally possible.
Democrats challenged the timing, saying Christie was afraid of appearing on the same ballot as the popular Booker. But courts upheld the governor's election schedule.
Booker had a running start on the election. Before Lautenberg died, Booker passed up a chance to run against Christie this year, saying he was eyeing Lautenberg's seat in 2014, in part so he could complete a full term as mayor - something he won't do now that he's heading to Washington.
He won an August primary against an experienced Democratic field including two members of Congress and the speaker of the state Assembly in a campaign that was largely about ideas.
The general election was about deeper contrasts, both ideological and personal.
Lonegan stepped down as New Jersey director of the anti-tax, pro-business Americans for Prosperity to run. Lonegan, who is legally blind, got national attention as mayor of the town of Bogota when he tried to get English made its official language.
After two runs in Republican gubernatorial primaries and as the leader of successful campaigns against ballot measures to raise a state sales tax and fund stem-cell research, Lonegan was a favorite of New Jersey's relatively small right wing.
Gathered with supporters Wednesday evening in Bridgewater, he said, "Unfortunately for whatever reason the message we delivered together ... did not win the day."
Lonegan told The Associated Press he has no plans to challenge Booker again next year or seek any elected office again.
The two candidates had portrayed each other as too extreme for the job.
Throughout the campaign, Lonegan was aggressive, criticizing Booker during a string of homicides in Newark, holding a red carpet event in rally to mock the time Booker spent fundraising in California and declaring that "New Jersey needs a leader, not a tweeter."
Lonegan also criticized Booker when a Portland, Ore., stripper revealed a series of not-so-salacious Twitter messages she'd exchanged with Booker, who's single. The topic resurfaced last week when Lonegan fired a key adviser after a profane interview in which the adviser suggested Booker's words were "like what a gay guy would say to a stripper."
Lonegan had called it "strange" that Booker won't say whether he's gay. Booker, for his part, has said his sexuality should not matter to voters and has been elusive on the subject.
At a debate this month, Lonegan responded to Booker's comments about the need for environmental regulations to clean a river through Newark. "You may not be able to swim in that river," he said. "But it's probably, I think, because of all the bodies floating around of shooting victims in your city."
Booker seemed stunned at the remark, and his campaign has criticized Lonegan for it.
Mulvihill reported from Trenton. AP reporters Angela Delli Santi in Trenton, Samantha Henry in Newark and Bruce Shipkowski in Bridgewater contributed.