President Sergio Mattarella, who had vowed Saturday that he would move quickly to fill the void, summoned Renzi's Democratic Party (PD) ally to the presidential palace.
Gentiloni, who served as foreign minister under Renzi, was asked by President Sergio Mattarella to form a new centre-left government that will guide Italy to elections due by February 2018.
A close ally of the outgoing premier, Gentiloni now has to put together his own government team ahead of a parliamentary approval vote expected on Wednesday.
In a brief statement, Gentiloni said there was an "urgent need for a fully functioning government" to address a series of pressing international, economic and social issues.
"Not by choice but out of a sense of responsibility I will be forming a government based on the outgoing majority," Gentiloni said.
The move by President Mattarella came after three days of consultations with political parties failed to produce any consensus on what happens next, with opposition parties rebuffing overtures about a possible national unity government and Mattarella rejecting demands for an immediate election.
Renzi, who had been in power for two years and ten months, resigned last week after voters overwhelmingly rejected a package of constitutional reforms on which he had staked his future.
Gentiloni met with Mattarella at 12:30 (1130 GMT) on Sunday.
Opposition parties were anticipating that the required vote of confidence in a new administration headed by Gentiloni would take place on Wednesday.
The populist Five Star Movement, which has led calls for immediate elections, said it would boycott the vote because the new government would have no legitimacy.
"This government is not even worthy of a vote against it," said Giulia Grillo, head of the Five Star group in the Senate.
Mattarella said Saturday the country urgently needed a "fully functioning government" to handle a string of pressing problems.
Gentiloni, 62, is a close ally of Renzi and will be seen by the opposition as a puppet premier keeping the seat warm for his colleague, who is planning a comeback at the next election.
That is due by February 2018 but could take place up to a year early.
Five Star, Italy's biggest opposition party, and the far-right Northern League are demanding a vote as soon as possible.
But Mattarella, who enjoys extensive executive powers during government crises, said Saturday an election could take place only after revision of current electoral laws.
Theoretically that could happen quickly but the process of harmonising the rules governing elections to the two houses of parliament, the Chamber of Deputies and the Senate, could also drag on for months.
As things stand, the lower house would be elected by a system under which the largest party is guaranteed a majority of seats while the Senate would be voted in under a proportional representation system.
Most observers agree that this is a recipe for perpetual conflict and government gridlock as the two chambers have equal powers.
The situation could be simplified at the end of January, when the constitutional court is due to rule on the legitimacy of the new winner-take all system for the Chamber of Deputies.
Gentiloni had taken over as foreign minister in October 2014, having been plucked by Renzi from back bench obscurity to replace the current EU foreign policy chief, Federica Mogherini.
His only previous government experience was two years as Romano Prodi's communications minister from 2006-08.
He is a longstanding friend and ally of Renzi and cynics will say that the silver-haired, grey-suited deputy's primary qualification for the job is that he poses no threat to the outgoing premier's comeback plans.
A registered journalist, Gentiloni has been either a full-time activist or a politician since his days as a far-left political science student in the mid-1970s.
Gentiloni's first tricky task as prime minister is likely to be overseeing a rescue of troubled bank Monte dei Paschi di Siena (BMPS).
A state-funded salvage operation is seen as inevitable following the European Central Bank's refusal on Friday to allow more time for a private bailout.
Under EU rules, state funds can be injected into troubled banks only if private creditors accept losses. In the case of BMPS this could hit many small investors who hold the bank's junior bonds.
Imposing losses at smaller banks last year caused outrage in Italy and damaged Renzi's standing.