jn,
When is this trip taking place? Regarding your questions......
- The best method (IMO) would be to drive to La Spezia, drop the car and then use the local trains to reach the five towns of the C.T. The trip from La Spezia to the closest village (Riomaggiore) is only about eight minutes. NO, it's not best to buy the train tickets online since many of the trains in that area are Regionale and it's awkward to buy those online and there's absolutely NO reason to do so. Buy them at the local stations from a Kiosk or ticket agent.
- Four days is not too long, but that will depend mostly on what you want to see and do in that area. If you want to hike the trails, allow one day for that (more on that below), exploring the five towns will take the better part of another day, and if you want to take a few day trips to nearby towns such as Porto Venere, Levante, Santa Margherita Ligure or Portofino, that will take another day. The trip from Monterosso to Porto Venere by boat is a really nice day trip. I'd also suggest leaving some time just the "chill" in the town you're staying in. If you just want to have a quick look and hike the trails, two or three days should be adequate.
As you'll have a car, are you aware of the usual "caveats" regarding car rental and driving in Italy? If not, post another note.
I'm assuming the trails you're referring to are the Sentiero Azzurro, which are the usual ones most tourists want to experience. Note that the different segments may be open or closed at any particular time due to storm damage, so you may or may not be able to hike them. At the moment, only the segment from Monterosso to Vernazza is open, but this could change at any time. Check with your hotel staff when you arrive or the "official" park website - http://www.parconazionale5terre.it/sentieri_parco.asp?id_lingue=1
One other point to note is that you'll require a Park Pass to hike the trails. Those can easily be bought at local stations or from the small wooden huts at the entrance to each trail.
Which of the five towns are you planning to stay in?