Pandya has been out of action since last October after suffering an ankle injury during a 50-overs World Cup match in Pune
The Paris St-Germain forward coolly side-footed the home the spot kick in the 76th minute after Diego Laxalt was adjudged to have brought down Danilo.
Until then Brazil had looked the more vulnerable of the two sides with Alisson making three fine saves, including a superb stop from a Luis Suarez free kick early in the second half.
It was the fifth win in a row for Brazil since they were knocked out of this year's World Cup in the quarter-finals by Belgium.