The Brazil-England friendly match on Sunday is set to be played after a judge overruled a previous court order that had suspended the match on safety issues.
The Rio de Janeiro state government issued a statement confirming the new ruling just hours after judge Adriana Costa dos Santos issued an order Thursday saying the match at Rio de Janeiro's renovated Maracana stadium could not proceed.
The statement said "the match between Brazil and England is confirmed on June 2 with all the safety conditions assured."
The chaos of the on-again, off-again match raises more red flags about Brazil's readiness to hold the Confederation Cup, which opens in two weeks, and next year's World Cup and the 2016 Rio de Janeiro Olympics.
The Brazil-England game and the opening of the Confederations Cup two weeks later are being watched closely following a myriad of cost overruns and delays in building stadiums and related infrastructure over recent years.
FIFA, the governing body of world soccer, has been complaining openly for a more than a year that Brazil is not ready.
FIFA Secretary General Jerome Valcke was in Brazil earlier this month to check on venues. He's acknowledged the Confederations Cup will be a maze of unfinished work and admitted that "not all operational arrangements will be 100 percent." He then warned: "This will be impossible to repeat for the FIFA World Cup."
"The World Cup, we can't reduce any requirement," he added. "On any (other) competition that would be fine, except at the World Cup. The World Cup is 99 percent of the FIFA system. The World Cup has to be perfect. The World Cup is the diamond of FIFA."
Early in 2012, Valcke angered Brazil officials with a blunt assessment that made international headlines. The rift was eventually settled, but delays remain in finishing stadiums and other infrastructure such as airports, roads and hotels for the World Cup. Much of that infrastructure will not be ready for the Confederations Cup.
FIFA and the local World Cup organizing committee tried to distance themselves from the problems, saying they were not responsible for organizing the Brazil-England match.
Local organizers, however, acknowledged they are using the match to view "operational areas."
In her ruling, Costa dos Santos said she was canceling all matches in the stadium until local organizers presented the documents showing the venue is appropriate to host events. She said the decision was made to guarantee the "safety of fans at the Maracana."
Prosecutors said they received a police report, that the stadium presented "safety risks" and added that "dangerous materials" were at the site.
They also noted there were not adequate measures for crowd control at the 79,000-seat venue, which has been renovated several times in recent years, with some estimates suggesting $1 billion has been spent.
The government said the problems were due to a "bureaucratic error," and said a report showing the stadium is safe was not delivered to the proper authorities.
The six stadiums being used for the Confederations Cup are in various stages of readiness. Six others that will be used for next year's World Cup are still being built, and FIFA has demanded they be ready by Dec. 31.
The Maracana stadium in Rio is scheduled to host the Confederations Cup final on June 30, and will be the venue for the World Cup final next year. It is also slated to host the opening and closing ceremonies of the 2016 Olympics.
Brazilian President Dilma Rousseff this week praised the six Confederations Cup venues, including Maracana.
"Many people did not think we would be able to build these stadiums before the Confederations Cup at the standards required by FIFA," Rousseff said.
She made reference to the "old-mutt" complex, a sense that Brazil lacked confidence and would fail to meet the challenge.
"But the workers who built these stadiums, the businessmen hired to do these works and all the governments involved have proved that Brazil is able to accept challenges and fulfill promptly commitments undertaken," Rousseff said.
In a bad omen, the day that Rousseff spoke a small part of the roof at the stadium in Salvador — a Confederations Cup venue — collapsed under the weight of heavy rainfall. There were no injuries.
The stadium that will be used for track and field at the Olympics also was closed earlier this year because of a faulty roof.
The England squad, which is hoping to qualify for the 2014 World Cup, arrived in Rio on Thursday for the match.
Associated Press writer Stan Lehman and AP Sports Writer Tales Azzoni contributed to this story from Sao Paulo.
Follow Stephen Wade at http://twitter.com/StephenWadeAP