The single will go on sale in October, ending months of speculation about how they would mark their revived friendship.
The song, Shame, is the first duet the pair have recorded together and was written jointly.
After Williams quit Take That in 1995, he and Barlow had a bitter falling-out for many years.
But they have built bridges over the past two years and Williams shared a stage with his former bandmates at a charity concert for Children In Need last November. The pair were also seen together at yesterday's charity football event, Soccer Aid, at Old Trafford.
The single – out on 4 October – is taken from a new double CD greatest hits album In And Out Of Consciousness which Williams is to release later in the year.
Williams received a Brit Award for his outstanding contribution to music earlier this year.
He said: "It's incredible to listen to the album and realise that it's already been 20 years of making music and playing gigs.
"And the great thing about the album is that it's not only a celebration of my past but also a bridge to the future. The fact that part of the future includes a name from my past makes it all the more poignant for me."
Williams went on to enjoy huge success as a solo artist after parting ways with Take That, enjoying seven No 1 albums over a decade. However, he appeared to tire of the limelight and disappeared from public view following the release of 2006's Rudebox. That year, Take That enjoyed a successful reunion and have since released two chart- topping albums as a quartet.