The state Supreme Court ruled unanimously in Emanuel's favor, saying an appeals court decision that said the candidate needed to be physically present in Chicago was "without any foundation in Illinois law."
"As I said from the beginning, I think the voters deserve the right to make the choice of who should be mayor," Emanuel said shortly after getting word of the high court's action. "I'm not quite sure emotionally where I'm at.
"I'm relieved for the city. I'm relieved for the voters because they need the certainty that's important for them."
When he learned of Thursday's ruling, Emanuel said he immediately called his wife and took a congratulatory call from his old boss, the president.
Political observers said the ruling resurrecting Emanuel's candidacy would probably give him added momentum heading into the last month of the campaign.
Don Rose, a longtime analyst of Chicago politics, said he thought the saga would bring Emanuel "even greater sympathy" and could lift him to victory.
"It's over," Rose said. "The only open question is whether he wins it in the first round or whether there's a runoff."
But the other contenders in the race did not give any ground.
"Game on," said Gery Chico, the city's former school board president and one of Emanuel's more prominent rivals. He complained that the recent "drama" surrounding Emanuel had "made this election into a circus instead of a serious debate about the future of Chicago."
Former Sen. Carol Moseley Braun said she did not question the court's decision.
"The fact is that the field hasn't changed. We're all still in this, and we're all trying to get our message out," she said Thursday at a televised debate, where she was joined by Emanuel, Chico and City Clerk Miguel del Valle.
However, if Emanuel does not get more than 50 percent of the vote on Feb. 22, a runoff election could be more difficult to win.
"It would show he wasn't strong enough," said Dick Simpson, a political science professor at the University of Illinois at Chicago. "It's going to be very turbulent in the next week or two. A number of voters will reconsider."
Emanuel never stopped campaigning as the case unfolded. Within minutes of the ruling, he was at a downtown transit station shaking hands.
The former White House aide has said he always intended to return to Chicago.
The Supreme Court took special note of Emanuel's testimony before the election board in which he listed all the personal items he left in the house in Chicago when he moved to Washington — including his wife's wedding dress, photographs of his children and clothes they wore as newborns, as well as items belonging to his grandfather.
The board "determined that, in this situation, the rental did not show abandonment of the residence," the court wrote. "This conclusion was well supported by the evidence and was not clearly erroneous."
In a conclusion that was unusually critical of the appellate ruling, the justices said Illinois' residency law "has been consistent on the matter since at least the 19th century."
While all seven justices ruled in Emanuel's favor, two of them issued a separate opinion that was more sympathetic to the lower court, saying Illinois residency law was not as clear-cut as the majority believed.
"It is for this reason that the tone taken by the majority today is unfortunate," the two justices wrote. "Because our own case law was, until today, unclear, it is unfair of the majority to state that the appellate court majority 'tossed out' 150 years" of precedent.
Chicago-based election attorney Adam Lasker said the reasoning behind the lower court ruling was sound, but he acknowledged that "there was a lot of pressure from the public."
"The court of public opinion may have won this one," he said.
In the future, the decision could allow less prominent or desirable figures than Emanuel to get on the mayoral ballot.
"It could become known as the Landlord Rule," he said. "Now anyone who rents his house, leaves clothes in it and moves out of Chicago, can come back, and they can be a candidate."
But Edward Foley, a law professor at Ohio State University, said the high court ruling made sense.
"This wasn't a slam-dunk for Emanuel going in," said. "But it shows the justices saw the appellate court ruling as a hiccup."
When faced with an ambiguity in election law, he said, the justices "decided that you want to err on the side of letting voters vote for candidates that they want to."
In their appeal to the Supreme Court, Emanuel's attorneys called the appellate court decision "one of the most far-reaching election law rulings" ever issued in Illinois, not only because of its effect on the mayoral race but for "the unprecedented restriction" it puts on future candidates.
His lawyers raised several points, including that the appeals court applied a stricter definition of residency than the one used for voters. They said Illinois courts have never required candidates to be physically present in the state to seek office there.
Monday's surprise ruling threw the mayoral race and Emanuel's campaign into disarray. The following day, the state Supreme Court ordered Chicago elections officials to stop printing ballots without Emanuel's name on them.
Chicago election officials said they had printed nearly 300,000 ballots without Emanuel's name before they abruptly stopped.
Emanuel had been the heavy favorite to lead the nation's third-largest city, and he raised more money than any other candidate vying to replace Daley, who is retiring after more than two decades as mayor.
When Emanuel's candidacy appeared in doubt, the other main candidates in the race moved quickly to try to win over his supporters.
The residency questions have dogged Emanuel ever since he announced his bid. He tried to move back into his house when he returned to Chicago, but the family renting it wanted $100,000 to move out early.
The elections board and a Cook County judge had previously ruled in favor of Emanuel, a former congressman.
In the Emanuel family, Thursday's decision was to have lasting implications.
"I have banned the word resident in Scrabble in our household. I never want to see it again," said Emanuel, adding that his family enjoys the board game. "Even if you get it on a triple word you're not allowed to use it."
Associated Press writers Michael Tarm, Tammy Webber, Sophia Tareen and Karen Hawkins contributed to this report.