The 62-year-old French banker and diplomat briefly wore an expression of relief after Supreme Court Justice Michael J. Obus announced his decision in a packed courtroom. Later, Strauss-Kahn blew a kiss toward his wife.
The ruling didn't immediately free Strauss-Kahn from the city's bleak Rikers Island jail. Authorities need time to review the security arrangements involved in his house arrest, which lawyers said would be at an apartment rented by his wife.
The lawyer who represented Strauss-Kahn at the hearing, William Taylor, called the ruling "a great relief for the family."
"He's going back to Rikers tonight and we expect him to be released tomorrow," he said.
Strauss-Kahn will not only have to post the full $1 million but will also have to take out a $5 million insurance bond. A trial date was not immediately set.
The banker is accused of attacking a 32-year-old housekeeper Saturday at his $3,000-a-night hotel suite. The West African immigrant told police that he chased her down a hallway, forced her to perform oral sex and tried to remove her stockings.
He spent nearly a week behind bars - most of that at Rikers, after a judge denied him bail on Monday. At that hearing, prosecutors warned that Strauss-Kahn might flee to France and escape justice in the U.S. like film director Roman Polanski.
This time, Strauss-Kahn went before a different judge, and also offered to place himself under house arrest. Obus added the requirement that he post the $5 million insurance.
The bail decision came less than a day after Strauss-Kahn resigned as managing director of the International Monetary Fund, the powerful organization that makes emergency loans to countries in financial crisis.
In his resignation letter, he denied the allegations against him but said he would quit in order to "protect this institution which I have served with honor and devotion" and to "devote all my strength, all my time and all my energy to proving my innocence."
Also Thursday, prosecutors announced that Strauss-Kahn had been formally indicted on the sex charges. Without the indictment, authorities would have been unable to detain him for longer than a week.
Strauss-Kahn didn't speak during the court proceedings, but Taylor said his state of mind was "much better now than before we started."
Prosecutors with the Manhattan district attorney's office had argued against his release, citing the violent nature of the alleged offenses and saying his wealth and international connections would make it easy for him to flee.
"The proof against him is substantial. It is continuing to grow every day as the investigation continues," Assistant District Attorney John "Artie" McConnell told the judge. "We have a man who, by his own conduct in this case, has shown a propensity for impulsive criminal conduct."
Similar house-arrest arrangements have been made for other high-profile defendants in the city, most notably Bernard Madoff, the Ponzi scheme mastermind who stole billions.
Taylor called the arrangement "restrictive," although he suggested few precautions were necessary.
"In our view, no bail is required to confirm Mr. Strauss-Kahn's appearance. He is an honorable man. He will appear in this court and anywhere else the court directs, and he has only one interest at this time, and that is to clear his name," Taylor said.
In France, a Socialist lawmaker and longtime ally, Francois Pupponi, expressed relief at the decision to allow Strauss-Kahn to leave jail. "There's finally a bit of good news in a terrible week," he said on BFM-TV. "We were no longer expecting good news."
Strauss-Kahn arrived for the bail hearing in a gray suit and an open blue shirt. As he entered, he turned to give a quick smile to his daughter and wife, the French television journalist Anne Sinclair, seated in the gallery.
Scores of reporters lined up outside the courtroom door before the hearing. Court spokesman David Bookstaver said it was one of the biggest media throngs at the courthouse since Mark David Chapman was arrested in 1980 for killing John Lennon.
The political wrangling over who will succeed Strauss-Kahn at the IMF already has begun. European officials, including Germany's chancellor, the European Commission and France's finance minister, have argued that his replacement should be a European.
Some authorities from China and Brazil have said it is time to break Europe's traditional dominance over the position and appoint someone from a developing nation. U.S. Treasury Secretary Timothy Geithner has asked for an "open process," without mentioning any specific candidates.
Associated Press Writers Karen Zraick in New York and Elaine Ganley in Paris contributed to this report.