Motivation is very simple - and challenging to implement.
First, have a clearly defined goal. Make sure that it's understood and articulated by everyone. This is not a pablum "mission statement" or the "Fish Philosophy" or "TQM" or whatever management fad is going around at the time. This is "We need to accomplish X by time Y." An extreme example of this happened during the Apollo 13 mission - NASA engineers were woken up at 3 AM and driven into Marshall Space Center, given a collection of old socks electrical batteries and rubber bands and were told to fashion a CO2 scrubber out of it in 12 hours. Your goals need not be life and death, but they do need to be clear and accepted by everyone.
Communicate progress towards the goals. Set milestones. Set dollar amounts for meeting the mile stones, and when they're met, give everyone a share of the reward, or an office party or a day off. Do NOT play the "If you don't do X, the office party goes away" game. That's a de-motivator of the first order.
Communication also means that everyone on the team has to communicate their progress as well. This should be done publicly; failing to meet the posted goals is a motivational tool for people who depend on the approval of their peers. Likewise, when performance is flagging, use an objective measurement, walk through how it was derived, and talk about what needs to improve, and then ask for input on how to fix the problem.
When projects fail, accept the blame. Then find the causes. If you have people who didn't pull their weight, make sure they suffer the consequences. If you have promised a reward, make sure that the people who fell short do not get it - financial rewards are pretty strong motivational tools.
When people do make a project fly, it's also your responsibility to give out the accolades. One of the first things the Army teaches newly minted captains is that punishment and dressing down should be done in private, while awards and thank yous should be in front of the troops. This is a metric that more managers should follow, and in particular, never ever forget to say, "thank you" to an employee who feels like they've gone the extra mile. It costs you nothing and pays dividends to your entire organization.