Mastroianni led off the 10th with a double off Vicente Padilla (4-1) and, one out later, Carroll placed a hit just over the glove of leaping second baseman Dustin Pedroia, sending Mastroianni sliding home with the decisive tally.
The run made a winner of Jeff Grey (6-1), who hurled 1 1/3 scoreless innings.
Jared Burton collected his fourth save with a 1-2-3 bottom of the 10th for Minnesota, which has taken the first two contests of a four-game series.
Minnesota spotted the Red Sox a 5-1 lead but scored four times in the fifth to tie it up, highlighted by Justin Morneau's two-run single. The Twins first baseman finished 4-for-4 with a run scored.
Carl Crawford contributed three hits -- including a three-run homer -- for Boston.
McPhee, Cokas 'working on their marriage' after affair
Ohio bar shooting arrested, charged with murder