Orient went ahead in the fifth minute with a superbly struck low shot by striker Ryan Jarvis after Jimmy Smith had set him up.
Gillingham were level when Mark McCammon’s shot was parried by Orient keeper Jamie Jones and Curtis Weston pounced on the loose ball to fire home after 20 minutes.
Orient regained the lead eight minutes later when Sean Thornton gathered the ball in midfield, advanced unchallenged and lashed his shot into the top corner from outside the penalty area.
Orient added a third when Luke Summerfield enabled Smith, moving in from the right, to curl his shot into the far top corner four minutes after the break.
Jones made an important save from Andy Barcham, but it took the visitors more than an hour to earn their first corner, whereas at the other end Gillingham goalkeeper Simon Royce turned over a fierce drive from Smith.