Laura Massaro has become Britain's first women's squash world champion since 1999 after beating Egypt's Nour El Sherbini in a tense final in Malaysia.