Tiwonge Chimbalanga and Steven Monjeza were married in a traditional but symbolic ceremony in southern Malawi on Saturday, attracting hundreds of curious onlookers.
"We met at church where we both pray and we have been together for the last five months … I have never been interested in a woman," Monjeza told The Nation newspaper.
Homosexuality is banned in Malawi and carries a maximum sentence of 14 years.
"I have just read about it (the marriage) in the press and the law in Malawi does not allow such practice and therefore the law will have to take its course," Attorney General Jane Ansah said.
Three years ago the Anglican Church sent pro-gay rights Bishop Nick Henderson to head a diocese in rural Malawi.
The congregation did not accept him and protests led to the death of a church member.
But the fight against HIV and AIDS is slowly changing the official position against gays and the government made its first public comment on homosexuality in September, when it said gay rights need to be recognised to help fight AIDS.
The Centre for the Development of People (CEDEP), a local organisation working with homosexuals, estimates 25% of the country’s gay men are HIV positive.
Malawi’s health ministry says the overall rate of HIV infection is 12%.
AIDS has killed more than 800,000 people in Malawi since the first case was reported in 1985 and left more than a million orphans.