Is it easy to change your major after starting your PhD or masters, if it is necessary?
Unfortunately, no, it's not so easy to change PhD programs.

It isn't like changing your undergrad major, where you just have to fill out some forms and get your advisors to sign off.  At the graduate level, each department does its own admissions.  So if you are in a mechanical engineering program and want to switch to applied math, you have to submit an application to the applied math program just like anyone else.  You'll be competing for a seat against every other applicant from around the world, most of whom will have completed a full undergrad mathematics major.

You might be able to improve your odds by getting to know faculty in the math program before you apply, perhaps discussing (or working on) research projects with someone there.  However, keep in mind that you will also need to stay in good standing in the engineering program, and you won't have a lot of spare time to explore math opportunities.

Also, from your description, your math background sounds much too light for entry into a math grad program.  Applied math can be more flexible than pure math, but having no advanced courses at all doesn't sound too good.  In fact, I'd be concerned that without advanced coursework, you may not even have enough of a sense of the field to know that it's really what you want to do.  Mathematics courses have a sharp change in flavor and difficulty as you transition from lower-level computational courses (calculus, differential equations, etc) to upper-level theory courses (real analysis, abstract algebra, topology).  Entering a PhD program having only the former kind of courses would be roughly analogous to being a go-kart enthusiast racing in the Indianapolis 500.  And it won't be easy to pick up extra math courses while in an engineering program; grad program requirements rarely allow for free electives.

Perhaps something that might better fit your situation is a post-baccalaureate ("post-bac") program.  These are one-year programs designed for students who have completed a bachelors and want to attend grad school in math, but need further preparation.  Such programs are offered by relatively few institutions, but I believe some of them are quite well-known in the community and have very good placement rates.