The race was too close to call Tuesday evening, but with 100 percent of precincts counted, Mr. Heller held 45.91 percent of the vote to Mrs. Berkley’s 44.69 percent. A third candidate, the Independent American Party’s David Vanderbeek, took 4.88 percent of the vote.
A fourth ballot option, “None of these candidates,” won 4.51 percent of the total, according to figures posted by the Nevada secretary of state.
The victory was a rare bright spot on a night in which Republican hopes of perhaps seizing control of the Senate were dashed, despite far more Democrats facing the voters than Republicans. With one Senate race in North Dakota still undecided, Democrats appear poised to expand their working majority in the chamber by one or two seats, when left-leaning independents are included.
Mr. Heller avoided the fate of candidates trying to hold Republican-held seats in states such as Massachusetts, Missouri and Indiana, who all lost Tuesday night, although Mrs. Berkley made the race closer than many polls had suggested.
“I am so grateful to our team of volunteers who knocked on doors, made phone calls and dedicated so many long, hard hours to achieve victory tonight,” said Mr. Heller in a statement Wednesday after his victory. “This was a hard fought campaign, and I would also like to thank Congresswoman Berkley for her service to our state and to our country.”
Mr. Heller won every county except Clark County, home of Las Vegas, which makes up 70 percent of the state’s population. Mrs. Berkley, who represents Las Vegas in Congress, took 34 percent of the vote in Clark County to Mr. Heller’s 28 percent.
But her Clark County lead wasn’t enough to offset his advantage in Washoe County, the state’s second-largest county, and the state’s smaller rural counties.
Mrs. Berkley, who trailed by several points in the polls through most of the campaign, may have been buoyed by President Obama, who won Nevada by a margin of 52 to 46 percentage points.