The song is a soft emotional ballad, and is dedicated to his daughter, North West, who was born in 2013.
The 37-year-old rapper released his last album, critically acclaimed Yeezus, in 2013, and received two Grammy nominations.
But the new song is in a very different style from the experimental electronic hip-hop of that album.
It features auto-tuned vocals and organ music played by McCartney.
The singer takes on the voice of his mother, Donda West, who died in 2007, and addresses both himself, using his middle name Omari, and his baby daughter, using her nickname Nori.
The two musicians were rumoured to be collaborating last year.
A statement from McCartney on his official website said: “For any of you guys who were wondering what I was doing with Kanye … Here it is: Only One.
“Happy rocking new year!”
On Twitter, West’s wife, Kim Kardashian West, revealed that the ballad was her favourite of his songs.
She said: “People always ask me what my favourite Kanye song is and it’s Only One. Kanye feels like his mom sang through him to our daughter.”
She added: “I cry every time I hear this song.
“And such a beautiful photo of Kanye and North by Inez and Vinoodh.”
The artwork for the single features an image of West with his daughter on his lap.
Dutch photography duo Inez van Lamsweerde and Vinoodh Matadin have previously worked with artists including Lady Gaga and Bjork.