Mastroeni struck first in the 35th minute and became the 13th different Colorado player to notch at least one goal this season. Nyassi then registered his fourth goal in the 45th minute after receiving a perfect through pass from Omar Cummings.
The defending MLS Cup champion Rapids (8-6-10) increased their unbeaten streak to three - 2-0-1.
Philadelphia's Roger Torres scored during stoppage time in the second half despite being a man down.
In the 64th minute, Union defender Sheanon Williams argued vehemently after a non-call and was eventually given a red card and ejected from the match. The Union played with 10 men the rest of the way.
Colorado improved to 4-4-4 on the road and won without leading scorer Conor Casey, who ruptured his left Achilles' tendon on July 16 against Seattle. Casey, who will miss about eight months, still leads the Rapids with six goals.
The Union had their five-match unbeaten streak (2-0-3) snapped while also suffering their first home loss (5-1-4). Only Sporting Kansas City (3-0-3) and the LA Galaxy (6-0-5) remain unbeaten at home.
Philadelphia entered the match at 8-5-7 and tied with the Columbus Crew for first place in the Eastern Conference with 31 points.
Philadelphia forward Carlos Ruiz, the team's leader goal scorer with six, was not active for the game.