Chief Justice Lovemore Munlo, reading the three-judge panel's ruling, also said the singer's commitment to helping disadvantaged children should have been taken into account when deciding on Madonna's request to adopt 3-year-old Chifundo "Mercy" James.
Madonna has founded a charity, Raising Malawi, which helps feed, educate and provide medical care for some of Malawi's more than 1 million orphans, half of whom have lost a parent to AIDS.
Children's welfare groups had expressed concern that rules meant to protect children were being bent because of Madonna's celebrity, and perhaps out of gratitude for what she has done for Malawi, one of the world's poorest and most AIDS-ravaged countries.
A Malawian man claiming to be Mercy's biological father had , as CBS News correspondent Priya David reported last month.
James Kambewa, a security guard, says he'd been told Mercy had died in childbirth. The girl's maternal relatives have said they don't believe Kambewa is the father, and his objections weren't addressed in Friday's ruling, which removed all his potential parental rights.
He told David on Friday that the court's ruling had left him in tears.
"I'm crying," he said. "I need my baby. I don't know where I can find any help."
Madonna's lawyer, Alan Chinula, said he called his client after the ruling was announced Friday.
"It's the wee hours of morning in New York, but she is excited at the news," Chinula said. "As her lawyer, I am happy that this has settled this contentious issue."
In a statement issued Friday, Madonna went further, saying, "I am extremely grateful for the Supreme Court's ruling on my application to adopt Mercy James. I am ecstatic. My family and I look forward to sharing our lives with her."
Chinula said he would now turn to arranging a passport for Chifundo, which could take several days, and was awaiting word from Madonna on travel plans for the girl. The adoption may not be final for some time.
Madonna had appealed after the lower court ruled she could not adopt the girl because the singer had not spent enough time in Malawi. The lower court said residency rules had been bent when Madonna adopted her son David from Malawi last year.
The appeals court said that was a narrow interpretation based on old laws.
"In this global village, a man can have more than one place at which he resides," Munlo said in the ruling, which took more than an hour to read in court Friday. "The matter of residence should be determined at the time of application of the adoption. In this case, Madonna was in Malawi not by chance but by intention. She is looking after several orphans whose welfare depends on her. She can therefore not be described as a sojourner."
The ruling also said the judges saw only two options for Chifundo, "either to stay at the orphanage without the love of family and live with the possibility of destitution, or be with Madonna where she is assured of love.
"Every child has the right to love."
Madonna met the girl in 2006 at Kondanani Children's Village, an orphanage in Bvumbwe just south of Blantyre. It was the same year she adopted David, who she found at another orphanage in central Malawi.
The girl's 18-year-old mother was unmarried and died soon after she gave birth. Since Madonna moved to adopt the girl, a dispute has arisen between the girl's maternal relatives, who agreed to the adoption, and a man claiming to be her father who said he wanted to care for the girl himself.
Peter Baneti, an uncle reached by phone in his village just outside Blantyre, said the family welcomed Friday's ruling.
"We hope Mercy will be joining Madonna soon," he said.
The chairman of the coalition of non-governmental organizations that had opposed Madonna's adoption efforts said Friday's ruling "disregarded" international agreements on children's rights and adoptions.
Undule Mwakasungula also took issue with the argument that because Madonna has made an investment in the country and has interests there, she could be considered a resident.
"We are a bit surprised but we can't challenge it because the Supreme Court has ruled and we have to go with that," he said.