The 'A Team' singer announced that he had been busy in the recording studio with the Dutch DJ and producer on his Instagram account last night (01.09.14).
Alongside a photo of them smiling at each other, Ed wrote: "Finished up my very first EDM song with Martin Garrix, brilliant experience, looking forward to you all hearing it."
Martin - who has worked with AfroJack - was also happy to share the news with his fans as he tweeted: "Studiotime with @edsheeran I love it!!! #RewindRepeatIt (sic)"
The collaboration marks the first EDM (Electronic Dance Music) song for Ed, who is usually known for his pop/folk records.
The 'x' singer also recently confirmed that he's been in the studio with David Guetta. Although Ed revealed that they had co-written two songs together, he added that they would not be released by himself and would instead be given to other artists.
He told Billboard.com: "Two days ago, I wrote and recorded two songs with David Guetta, for some other people to sing. I'm going in tomorrow to do some stuff for myself."