Canada beat South Africa 1-0 to reach the World Cup last ​16 for the first time in their history.