The alliance, the first at federal level between the ideologically disparate Greens, the libertarian Free Democrats, orFDP and Scholz's centre-left SPD, ends 16 years of Merkel-led conservative governments.
The three parties enjoy a majority in the lower house of parliament and hope the government will be sworn in early next month after they ratify the 177-page coalition pact.
Named after the parties' respective colours, the traffic lightalliance will usher in a new era of relations with Europe, and plans to speed up digitalisation of the continent's biggest economy while maintaining fiscal discipline.
At a news conference in Berlin, flanked by the FDP and Greens leaders, Scholz recalled that when the first traffic light was erected at the city's Potsdamer Platz in 1924, many questioned whether it could work.
"Today, the traffic light is indispensable when it comes to regulating things clearly and providing the right orientation and ensuring that everyone moves forward safely and smoothly, " he said.
"My ambition as chancellor is that this traffic light alliance will play a similarly groundbreaking role for Germany."
Merkel leaves big shoes to fill. She has navigated Germany and Europe through multiple crises and been a champion of liberal democracy in the face of rising authoritarianism worldwide.
Her critics say she has managed rather than solved problems and leaves her successor tough decisions on many fronts.
The incoming government faces immediate challenges, with Europe grappling with the fallout from Brexit, a crisis on the European Union's border with Belarus and surging COVID-19 cases.
Scholz, 63, an experienced politician who was finance minister in the outgoing "grand coalition" of the SPD and conservatives, said that fighting the COVID-19 pandemic would be his top priority.
But his coalition also has ambitious medium- and long-term plans, including a faster expansion of renewables, an accelerated exit from polluting coal and a hike in the minimum wage, according to its pact.
Underscoring its socially liberal bent, the coalition also agreed to allow multiple citizenship, increase regular immigration, reduce the voting age to 16 and make Germany the first European country to legalise the sale of cannabis for recreational use.
Greens co-leader Annalena Baerbock, 40, is expected to become Germany's first female foreign minister and Scholz has said he wants a gender-equal government.
While Germany's electoral campaign was largely focused on domestic issues, the parties signalled in the coalition pact an openness to reform the bloc's fiscal rules, also known as the Stability and Growth Pact.
They also agreed Germany would remain part of NATO's nuclear sharing agreement, a move that will prevent a rift in the Western military alliance at a time of rising tensions with Russia.
The incoming coalition will have to balance the Greens' calls for a tougher line on Russia and China on human rights with Scholz's likely preference to avoid confrontation over Taiwan and Ukraine.
FDP leader Christian Lindner, 42, is set to take over at the finance ministry and Greens co-leader Robert Habeck, 52, is widely expected to take on a newly expanded economy and climate change ministry.
AUF WIEDERSEHEN, ANGELA
Presiding over what could be her final cabinet meeting, Merkel bade her colleagues farewell earlier in the day, and Scholz presented the EU's longest-serving leader with a tree to plant in her garden.
Merkel, who did not seek re-election after four terms as chancellor, retains a high personal popularity rating but her conservative party is in disarray. It faces a leadership contest after a gaffe-prone campaign by its candidate for chancellor saw it record its lowest ever vote in a federal election.
Germany's incoming leader is seen as a competent rather than a charismatic politician who, like Merkel, has moderate views and is adept at dialogue. During the campaign Scholz positioned himself as Merkel's natural successor, even imitating her trademark pose.
The challenge will be to build and maintain a consensus between the Greens and SPD, widely seen as natural centre-left partners, and the fiscally hawkish FDP which has historically been closer to Germany's conservatives.
The speed with which the parties struck the coalition deal was taken by some market watchers as a good early sign.
"If this professional approach continues once the government is actually in office, the country could finally get the reforms and investments it really needs," said Carsten Brzeski, chief economist at ING Germany.