Leader Angela Merkel called it “a good day”, while markets rallied in relief.
But the Constitutional Court imposed conditions including a cap on Germany’s contribution, which it said could only be overruled by the German parliament.
Critics had argued that the ESM commits Germany to potentially unlimited funding of debt-ridden eurozone states.
Some 37,000 people had signed a petition to the court asking it to block the ESM, and make it subject to a referendum.
Since Germany is due to contribute 27% of the fund, it cannot proceed without German ratification.
But, after weeks of deliberation, the court’s Chief Justice Andreas Vosskuhle said it “rejected the injunctions”, since there was a “high probability” that the ESM did not violate the constitution.
However, he said ratification of the treaty could only be allowed under certain conditions.
He continued: “No rule of the treaty must be interpreted in a way which would result in higher payment obligations by Germany, without the consent of the German representative.”
Correspondents said that meant that any future increase in the size of the 500bn-euro (£400bn) fund, or of Germany’s contribution, could only be permitted with the express agreement of Germany’s parliament.
When added to the money already committed to the existing temporary fund, Germany is liable for about 190bn euros.
The decision clears the way for Germany’s President, Joachim Gauck, to sign the ESM and the fiscal pact – which is meant to enforce budget discipline – into law.
Correspondents said there would be huge relief in Brussels and European capitals at the verdict.
“Today, Germany is once again sending a strong signal to Europe and beyond: Germany is assuming with determination its responsibility as the biggest economy and as a reliable partner in Europe,” Chancellor Merkel told parliament in Berlin hours after the ruling.
“This is a good day for Germany and it is a good day for Europe,” she said.
Spanish, Italian and German share indexes all rose after the ruling, while the euro continued its recent gains to post a hit a new four-month high against the dollar, at $1.29.
The borrowing costs on Spanish and Italian 10-year bonds fell.
Analysts suggested that, combined with European Central Bank plans to buy the government bonds of struggling countries, Europe now had the tools it needed to combat its financial crisis.
“Within less than a week, the eurozone has finally received its long sought-after impressive bazooka,” said Carsten Brzeski, an economist with Dutch bank ING.
“As a result, eurozone governments have now received more time to do their homework, implement reforms and austerity measures,” he said.