Ben Ellis, from Nashville, Tennessee, was so loved by his students they turned up in their droves to sing to him outside his home.
He was left fighting back tears at the window of his bedroom as 400 children serenaded him with song of worship, Holy Spirit You are Welcome Here.
Ellis lost his battle with cancer just 10 days later, in the early hours of Friday morning, according to the Christ Presbyterian Academy where he worked.
The clip showing the moving act was viewed millions of times after country music star Tim McGraw shared it on Facebook.
McGraw explained: "A friend sent this to me today.
"Ben Ellis is a Nashville area high school teacher battling cancer . The entire student body - 400 plus students plus HS faculty - drove to his house to worship with him.
He added: "Our thoughts and prayers are with him and his family... So precious and kind."
The video was recorded on Wednesday September 7, and the lyrics have a poignancy in Mr Ellis' condition: "Holy Spirit You are welcome here, come flood this place and fill the atmosphere, your glory God is what our hearts long for, to be overcome by Your presence Lord."
A woman who says she's a parent from the school posted on Facebook that the event came together about "three separate and unrelated people" told her they had been shown visions of the students singing praises on Mr Ellis lawn, Mirror reported.
"So we loaded the buses and cars and went," MailOnline report s Shannon Lee Seibert as writing.
212