TOKYO - Japan posted a goods trade surplus of 2.99 trillion yen ($27 billion) in 2017, the second straight year of black ink, as robust exports exceeded imports that surged amid higher energy prices, government data showed Wednesday.