Douglas Costa will join up with the Brazil squad for the Olympics. AP Photo/Kerstin Joensson

Bayern Munich have released midfielder Douglas Costa to play for Brazil at the Olympics, joining Neymar as one of the host nation's overage players.

Brazil technical director Gilmar Rinaldi made the announcement in a news conference on Tuesday shortly after he was sacked along with head coach Dunga following the Selecao's early exit from the Copa America.

Neymar was not available for the Copa because Brazil preferred for him to play at the Olympics instead.

Costa, 25, said on Brazilian television earlier this week that he did not believe Bayern would object to him playing in the Olympics after he had to pull out of the Copa squad with a muscle injury.

Teams in the Olympics are allowed three players over the age of 23 on the squad, and Neymar and Costa would leave one spot remaining.

"I want to thank Douglas Costa," Rinaldi said in a news conference. "We continued to talk over a long period of time and thanks to his efforts as well, we are obtaining the release from Bayern."

Rinaldi said it was important to him to complete the negotiations with Bayern despite losing his job.

"I am the head of the commission, despite being more on the administrative side," he said. "That is my responsibility, to deal with this situation on the eve of the Olympics.

"It would be selfish to just leave, so I am here until Thursday or Friday, working on the transition."

Brazil are set to reveal their 35-player preliminary squad on Wednesday.

Costa was part of a Bayern team that won the Bundesliga and the DFB Pokal in manager Pep Guardiola's final season with the team.

Sources told ESPN Brasil that Corinthians manager Tite is expected to replace Dunga to coach Brazil at the Olympics.