RIO DE JANEIRO - Brazil ended the Tokyo Games with their best ever placing on the medal table even though the country's athletes have had to cope with a reduction in investment since Rio hosted the Olympics five years ago.

The South American nation finished 12th in Tokyo with 21 medals, one place higher than in Rio and with two more medals.

Seven of the medals were gold, with Italo Ferreira capturing the first ever gold in surfing. Three Brazilians also grabbed silver medals in the new skateboarding events.

Brazilians also made the podium in canoeing, gymnastics, boxing, track and field, swimming, judo and sailing.

“We are close to realising the dream of entering the top 10 in the world,” said Marcelo Magalhaes, the country’s sports secretary.

“We are going to keep investing in sport and prioritising grass roots level so we can arrive at the top levels in great position.”

Brazil’s success came in spite of reduced investment. Government programmes for top-class athletes handed out 110 million reais ($21.03 million) less over the last Olympic cycle compared to the one leading up to the 2016 Games, according to data published in the O Estado de S. Paulo newspaper.

Some of Brazil’s most notable successes were in women’s events, with Ana Marcela Cunha winning the 10km marathon swimming, gymnast Rebeca Andrade taking gold in the vault, and Martine Grael and Kahena Kunze retaining their skiff 49er FX sailing title.

Laura Pigossi and Luisa Stefani also took Brazil’s first ever tennis medal, winning bronze in the women’s doubles.

The feat bucked the usual trend of medal tallies of Olympic host nations dropping off four years after they staged the Games. So far this century, Britain had been the only country to have won more medals at a Games that took place immediately after it had staged the Olympics. The 2012 hosts had won 65 medals on home soil and had increased that haul to 67 four years later in Rio.

The biggest disappointment for Brazil came in beach volleyball because for the first time since it was introduced into the Olympic programme in Atlanta in 1996, the country drew a blank. ($1 = 5.2301 reais)

(Reporting by Pedro Fonseca in Rio de Janeiro, writing by Andrew Downie, editing by Pritha Sarkar) ((andrew.downie@thomsonreuters.com; +55 11 99995-9571;))