In the 1990 World Cup, the Republic of Ireland advanced to the quarter-finals after drawing all three games in the group stage, and then beating Romania in the round of 16 on penalties after a 0-0 draw with Romania. They eventually lost to Italy 1-0. Not only did Ireland not win any of their games, they didn't take the lead in any either.
Also in 1938 World Cup, Sweden got to the quarter-finals without winning a game, but that was less impressive - there was no group stage and their Round of 16 match against Austria was never played and awarded as a walkover.
As for the Euros... well until 1980 the tournament was only four teams. In 1976, Czechoslovakia won the tournament without winning a regulation-time game: they beat the Netherlands 3-1 after extra time in the semis and then West Germany on penalties in the final. But that was only in a two-game tournament. After that, with only the top two qualifying from groups going through, no team has made it without winning at least one group game, until Portugal this year.