With all 208 precincts reporting, Ms. Handel had 51.9 percent of the vote to Mr. Ossoff’s 48.1 percent.

Addressing supporters in Atlanta, Ms. Handel noted with pride that she had become the first Republican woman sent to Congress from Georgia, and she pledged to represent all of her constituents, including Mr. Ossoff’s supporters. But she made clear that she would work to pass major elements of the Republican agenda, including health care and tax overhauls.

“We have a lot work to do,” Ms. Handel said. “A lot of problems we need to solve.”

For Democrats, the loss was demoralizing after questionable “moral victories” in two earlier special election defeats, for House seats in conservative districts in Kansas and Montana. Mr. Ossoff appeared so close to victory that Democrats were allowing themselves to imagine a win that would spur a wave of Republican retirements, a recruitment bonanza and a Democratic fund-raising windfall heading into the 2018 midterm elections.

Addressing a crush of cameras and supporters who spilled out of a hotel ballroom, a subdued Mr. Ossoff tried to strike a hopeful note as he conceded defeat.