The Roman origins of the town are evidenced by some of the artefacts found in the area, but the history of Santa Margherita, as has been documented, really began in the Middle Ages. Having become a fief of the Fieschi family in the XIII century it passed into the hands of Genoa. This was how matters remained until the end of the eighteenth century. On 18 July 1798 the village was still divided into two autonomous hamlets: Corte was situated in front of the port area, with Pescino by the sea next to the parish church on the Ghiaia beach - the two hamlets separated by a hill.
On that day, however, the "Municipalists" took control of Pescino, now presiding over the canton of Santa Margherita and the canton of San Giacomo - two cantons that were often in fierce rivalry with each other.
On 22 December 1812 Napoleon, through an imperial decree, definitively united Santa Margherita and San Giacomo in a single municipality bearing his august name, Port Napoleon (Porto Napoleone), but after the fall of the empire a governor was appointed in Genoa and each individual village passed into provisional administration.
In 1818, in accordance with the wishes of the governor, the city of Santa Margherita di Rapallo was founded, and was run by a Council of Elders, headed by Gerolamo Costaguta.
Finally, 45 years later in 1863, Vittorio Emanuele II decreed that the town be called Santa Margherita Ligure
