It was Egypt who started better with Mahmoud Kahraba coming close to opening the scoring inside the first minute, but the 19-year-old could only fire wide from inside the box.
Kahraba did not have to wait long to make amends, however, with the midfielder bursting into the penalty area before converting from close range.
Kahraba had another fine opportunity five minutes before the break, but the youngster could only head wide from inside the box.
Trezeguet had the first real chance of the second period just past the hour mark, but the Egyptian headed wide from close range.
Castillo came close to scoring his second for Chile moments later, but his header just moved past the far post at the vital moment.
Chile did move ahead with 15 minutes remaining, however, when Christian Bravo burst into the box before driving an effort into the far corner.
The South American side were reduced to 10 men late on when Cristian Cuevas was given his marching orders, but they held on for all three points.
Next up for Chile is a clash with England on June 26, while Egypt face Iraq on the same evening.