Replays showed Ruidiaz batted the cross from Andy Polo into the goal,
but Uruguayan referee Andres Cunha, after consulting with his assistant and on his microphone, confirmed the goal.
Both teams had claims for penalties from Cunha, who refused to call fouls on Coutinho and Dani Alves that would have given Brazil penalty kicks and an apparent trip on Peru's Edison Flores in the area late in the first half.
It was not the first game Brazil was involved in controversy. It had escaped from the Rose Bowl with a 0-0 draw in its opener against Ecuador after a shot by Miller Bolanos was ruled to have cross the end line before he fired it off Brazilian goalkeeper Alison and into the net.
In Sunday's first game, Ecuador's 4-0 win over Haiti ended its string of six straight exits in the group stage of the Copa America and set up a date Thursday with the United States in Seattle.
Peru then needed a win to keep alive its streak of getting out of the group stage in every Copa America since its exit in 1995. Only Argentina has a longer streak, having reached the knockout stage of every tournament since its first-round exit in 1983. The last time Brazil fell in the group stage was 1987.
Last group-stage exits (Copa America):
*Eliminated from 2016 Copa Centenario.
CROWD COUNT. Lionel Messi returned to Chicago's Solder Field for the first time since the infamous Messi & Friends all-star game three years ago, and he did not disappoint the 53,885 fans with a hat trick in 19 minutes off the bench.
The crowd was the largest of the weekend at the Copa Centenario and helped push the tournament average to 40,553 a game.
Largest Copa Centenario crowds:
ATT. GAME (VENUE)
83,263 Mexico-Jamaica (Pasadena, Calif.)
69,491 Argentina-Chile (Santa Clara, Calif.)
67,439 USA-Colombia (Santa Clara, Calif.)
60,025 Mexico-Uruguay (Glendale, Ariz.)
53,885 Argentina-Panama (Chicago)
53,158 Brazil-Ecuador (Pasadena, Calif.)
51,041 USA-Panama (Philadelphia)
49,438 Ecuador-Haiti (East Rutherford, New Jersey)
45,808 Costa Rica-Colombia (Houston)
42,766 Colombia-Paraguay (Pasadena, Calif.)
39,642 USA-Costa Rica (Chicago)
36,187 Brazil-Peru (Foxborough, Massachusetts)
28,241 Brazil-Haiti (Orlando)
25,560 Venezuela-Jamaica (Chicago)
23,002 Venezuela-Uruguay (Philadelphia)
20,190 Peru-Haiti (Seattle)
19,392 Chile-Bolivia (Foxborough, Massachusetts)
17,133 Costa Rica-Paraguay (Orlando)
13,466 Panama-Bolivia (Orlando)
11,937 Peru-Ecuador (Glendale, Ariz.)