"I am ecstatic," Madonna said in a statement in which she also thanked the court. "My family and I look forward to sharing our lives with her."
Madonna's lawyer Alan Chinula said he would now arrange a passport for Chifundo, which could take several days, and was awaiting word from Madonna on travel plans for the girl.
James Kambewa, a man who claims to be the little girl's father, told CBS news "I'm crying. I need my baby. I don't know where I can find any help," the network said.
But Peter Baneti, an uncle, said the family welcomed Friday's ruling.
"We hope Mercy will be joining Madonna soon," he said by phone from his village just outside Blantyre.
Madonna adopted a son, David, from Malawi last year, but her request to adopt Mercy was originally rejected in April when a lower court that said the star had not spent enough time in Malawi.
But Chief Justice Lovemore Munlo, reading the three-judge appeal court panel's ruling on Friday, said that was a narrow interpretation based on old laws and that "in this global village a man can have more than one place at which he resides."
He said the singer's commitment to helping disadvantaged children also should have been taken into account in the decision.
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.
Chinula said that with Friday's ruling, the adoption was final, as he had requested of the court. This could not immediately be confirmed.
When Madonna adopted David, the process took months and included a child welfare official's visit to Madonna's home, which then was in London, to review her fitness as a mother.
Chinula said none of this would be necessary this time.
"What the Supreme Court has done is grant a full adoption," he said.
The appeal court ruling took more than an hour to read in court.
"The matter of residence should be determined at the time of application of the adoption," Chief Justice Munlo read. "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," it said.
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 began the process of adopting David, whom 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 Kambewa, who says he is the father and wants to care for the girl himself.
Kambewa has acknowledged he had never seen the girl, but had tried to stop the adoption.
The girl's maternal relatives have said they do not believe Kambewa is the father, and his objections were not addressed in Friday's ruling.
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.
Copyright 2009 The Associated Press.