Barber, a bronze medalist at the 2014 Commonwealth Games and a silver medalist in 2018, narrowly missed out on a ticket to Birmingham after testing positive for COVID while she was on her way to Australia’s training camp after the world championships in Eugene, Oregon.
The 30-year-old was still positive a week ago but was later cleared to compete.
“I wasn’t going to let that affect my game today,” Barber said. “I had a lot of confidence from the world and a good feel for my javelin and I trusted the process.
“So today I was focused and I knew what I wanted to achieve.”
Barber looked like she was going to settle for silver behind Mackenzie Little until she produced a powerful effort of 64.43m in her final throw to wrest the title from her compatriot by just 16cm.
Indian Anna Rani won the bronze medal.
“I had a great start (63.52m in the first round) and then it just fell apart during the competition,” Barber said. “But my mentality is that every throw is an opportunity to show what I can do.