Zagitova, 15, bidding to top a golden debut to her first senior season in which she has won every competition, including gold in Pyeongchang four weeks ago, trails the 31-year-old Italian by a slim 0.76 points.
Kostner – competing in her 14th world championships – skated faultlessly to Celine Dion's Ne me quitte pas, hitting all her elements to score a new personal best 80.27 points, to the delight of the home crowd.
Photo: Marco Bertorello/AFP
Zagitova produced an elegant and solid performance to Black Swan, but looked shocked as she saw her score of 79.51 points appear – well below the world record 82.92 she achieved in South Korea.
"Honestly I was more nervous here than at the Olympic Games," said the teenager from Moscow. "It was very difficult to go back training after the Olympic. I took time to recover.
"I was very nervous because it is my first world championships. Every competition I'm learning something new."
She added: "Today I felt somewhat tight in my body. I think it was nerves, but I was happy I was able to give a clean performance. There were a few little mistakes but nothing serious."
On her home ice, Kostner was in reflective mood as she looked back to her first worlds back in Washington in 2003.
Kostner performing in 2012, the year she won a world championship. Photo: Toshifumi Kitamura/AFP
Kostner has six world medals – including the gold in 2012 – with her first a bronze in 2005. She also won Olympic bronze in Sochi 2014.
"In the middle of the programme there's a passage where there is silence," said Kostner, who finished fifth in Pyeongchang.
"I thought back to 15 years ago when I started skating internationally. Nobody in Italy followed figure skating.
"I feel so happy that people are sharing this passion with me."
Japan's Satoko Miyahara, a former world silver medallist, is sitting third with 74.36 going into Friday's free skate. Olympic bronze medallist Kaetlyn Osmond of Canada is fourth.