Gabriel Martinelli scored a stoppage-time winner for Brazil to beat plucky Japan 2-1 in the round of 32 at the World Cup on Monday.