Massaro, seeded fifth, beat the Egyptian on the way to winning the British Open last month, but could not repeat that performance in El Gouna.
El Welily won the quarter-final 8-11 11-8 12-10 11-6 in 46 minutes to make it three Egyptians into the last four.
That came before an unexpected rain shower in the Red Sea resort.
The outside court is fully exposed to the elements as rain is extremely rare at this time of year in El Gouna.
El Welily will next play France's Camille Serne, while top seed Nour El Sherbini will take on fourth seed Nouran Gohar in the other semi-final.
Massaro, 33, won the world title in 2013 and reached the final last year, before claiming her second British Open title in March.
"She's obviously a very strong player mentally and it's hard to break her," said El Welily, 28. "To beat her today is absolutely fantastic."
England's former champion Laura Massaro lost 3-1 to third seed Raneem El Welily on a day when rain stopped play at the squash World Championship in Egypt.