The Paper Planes hitmaker tells Entertainment Weekly magazine she and the former One Direction star created her new song Freedun over messaging app WhatsApp, while she was in India.
"We just basically did it while I was here," the Sri Lankan rapper explained. "We've just been going back and forth on WhatsApp."
M.I.A. and Zayn became friends when she was asked to write songs for his debut solo album Mind of Mine.
"We have the same publishers and they wanted me to demo some songs for Zayn," she stated. "I was thinking maybe I'll write for other people instead. I really wanted to write a song for Zayn.
"We had a couple people in common. And that's how it came about. I didn't really approach him for my own record until later on. First, I thought I wanted to try writing a song for him."
But they didn't get together in time for her to come up with anything for his break-out album, so they decided to collaborate for what she insists will be her final project, which will be released on 9 September (16).
M.i.a., who is known for her political outbursts, recently told the BBC the album, title AIM, is "the cleanest album I have", adding, "It's my last record so I just want it to be happy. There's no complaints on it."
The project also features guest spots from DJ Blaqstarr, Skrillex and M.i.a.'s ex-boyfriend, producer Diplo. It will be her fifth studio album.