Selena Gomez joins Taylor Swift for duet of 'Who Says' - video
Swift was performing the last date on her 'Speak Now' world tour, where she told the crowd it was a "special occasion" and on such occasions she wanted to be surrounded by her friends.
"One of my best friends is such an amazing singer and after four years of being best friends we have never stepped on stage together and I think that's such a shame... So it just so happens that Selena is here tonight," she said.
Gomez then appeared on stage for a duet of her own track 'Who Says', taken from her current album When The Sun Goes Down.
She later took to her Twitter account to say: ""Performing at Madison Square Garden with my best friend was a highlight.. Congratulations Taylor on Speak Now tour!! Love you."
Swift wrote on her own account: "I have so much to be thankful for this year. I'm leaving New York, replaying this tour in my mind. I love you all so much."
James Taylor also made a surprise appearance at the concert, joining Swift for a rendition of 'Fire and Rain'.
Before introducing him, Swift told the audience that it was the only song she liked singing in chorus class when she was younger, calling it "probably one of the most amazing, fantastic songs I have ever heard in my life".
The country star also said expressing her love for 'Fire and Rain' had led to her mother telling her for the first time that she had been named after James Taylor.
> Taylor Swift dominates 2011 American Music Awards
> Taylor Swift: 'I've written 25 songs for new album'