Sotnikova, 17, became the first Russian female to win an individual Olympic figure skating gold medal and she had to dethrone the defending champion to do it.
The young Russian received a score of 144.19 for her free skate performance, best of the evening, giving her a total of 224.59 for both the short and long programs.
That gave her a victory over South Korea's Yuna Kim, who was trying to become the first woman to repeat as Olympic figure skating champion since Katarina Witt won the title in 1984 and 1988.
Sotnikova's victory came 24 hours after the Russian hockey team was eliminated from the men's Olympic tournament in the quarterfinals, a setback that was treated as a national calamity in the country's sporting press.
One newspaper said the loss by the Russians to Finland amounted to holding the closing ceremonies to the Olympics four days early.
Sotnikova's win came after she had posted only a ninth-place finish at last year's world championships.
Kim's combined score was 219.11 and Italy's Carolina Kostner, competing in her third Olympics, won the bronze medal with 216.73 points. American Gracie Gold wound up fourth at 205.53.
Celebrity Breakups and divorces of 2014 [PHOTOS]