The acoustic ballad is the first fruit of his new record deal with legendary US label Capitol Records.
The star split from Simon Cowell’s Syco label earlier this month, but fans were not expecting new material to follow so quickly.
“I didn’t want anyone to know,” he told BBC Radio 1’s Greg James. “I wanted to keep it a secret until it was out.”
The 23-year-old has spent much of his downtime from One Direction playing golf – even caddying for Rory McIlroy in April this year.
He told James he had started writing songs “just because I could” this February, and This Town was “one of the first songs I wrote”.
But he kept his musical endeavours under wraps and did not even play his This Town to the other members of One Direction before its release.
The song finds Horan reminiscing about a childhood sweetheart over a simple strummed guitar, singing: “Yesterday I thought I saw your shadow running round / It’s funny how things never change in this old town.”
The star told Radio 1 the lyrics, which appear in handwritten form on the single’s artwork, had a “double meaning”.
“If you’re from a small town you’ll know there’s always one girl who, when you go back home, you always see them out and about in bars and stuff like that.
“The other meaning was about the town itself.”
This Town has already topped the iTunes chart in more than 20 countries and was co-written with Jamie Scott, one of One Direction’s go-to hitmakers, with credits including Story Of My Life and Drag Me Down.
Horan added that “there will be an album” next year but “I haven’t finished it yet”.