Philadelphia almost got back into the game when Conor Casey teed up Danny Cruz on the edge of the area, but his effort was beaten away by Sean Johnson in the Chicago goal.
After the break Johnson was called on again, this time to deny Sebastien Le Toux as he raided into the box, but the keeper managed to stop his low shot with his feet.
However, the Union found an equaliser minutes later when Sheanon Williams somehow bundled the ball into the net from Le Toux's free kick from the right giving Johnson no chance.
This parity did not last long, though, and the Fire regained the lead through Mike Magee as he lofted the ball over MacMath into the net after being played behind the Union defence by Nyarko.
As the game entered the dying minutes, Philadelphia had a great chance to get level once again as Jack McInerney found space inside the penalty area, but he could only fire his effort wide of the target, which condemned his side to a defeat.