Final answer:
The Vatican City gained independence as a result of the Lateran Treaty in 1929, becoming an independent state recognized by the international community.
Step-by-step explanation:
Through the signing of the Lateran Treaty in 1929, Vatican City gained independence and sovereignty, establishing itself as an independent entity distinct from Italy.
The treaty resolved a longstanding dispute and allowed for the recognition of the Vatican's neutrality and spiritual leadership, effectively making it the smallest internationally recognized independent state in the world by both population and area.