For me a lot of it is simply getting my head into the project - I usually enjoy all parts of a given project, but it's easy to procrastinate (web surfing, etc).
So I give myself 1 hour to do whatever I want (primarily checking email and websites that would otherwise distract during coding) and then force myself to read the project documentation or code for 15 minutes and make a plan for what I want to do next in the project - and I write it down in a todo list that's always on screen.
If I decide to stop there and relax some more that's fine, but usually once I make a plan I get interested/excited to work on it, and it doesn't take long to get into the 'zone'.
If I'm not working on it, I'll force myself to do at least 15 minutes of work every hour. It's not efficient, but eventually something catches (usually I have this huge drive to not leave code in a non-working state, so it's not hard) and I get started. Once started I have little interest in the things that were distracting me, but phone calls, emails, IMs etc will pull me away.
So I have to also decide whether I want to eliminate those distractions, or allow them and simply take those breaks. Whether I do that depends on how badly I want to finish a particular aspect of the work...