TBH I think that discipline is more important than motivation.
Motivation comes and goes and discipline is what gets you to the gym and makes you put the cake down on the days that motivation has gone AWOL.

I find that making myself accountable is helpful so putting out there that I will be at the gym more often helps me because then I feel like I need to keep my word.
I find classes help keep me motivated; it helps to have someone to push you a little bit harder, it gives you a definite time to put into your schedule, it helps establish a routine, after you get to know your fellow regulars it adds a social aspect.
One thing I try and keep in mind are that often doing your laces up is the hardest part of a workout so even if I don't feel like working out I go to the gym because once I'm actually there and working I often find that I stay for longer than I intended.

A food diary is good for keeping an eye on diet - if it's down there in black and white it's harder to rationalise.

I also found the weight loss challenge thread motivational because it helps having people to share with.