Spirit Tracks was a major improvement over Phantom Hourglass in almost every way.
One of my biggest complaints about PH is that it's too easy. I didn't get stuck once getting through it, and I didn't die at all. The puzzles weren't hard to figure out, the enemies and bosses were easy to kill, and the overall difficulty was just far lower than it should've been, even for a TWW sequel. ST, however, while still easy, took the things that made PH easy and improved them. The puzzles are far more innovative and challenging, the combat is less frustrating yet more difficult, and most of the bosses actually posed a fair challenge. I actually got stuck a few times and died twice. The game is almost undeniably harder, which is good. It's still fairly easy though.
Another thing I really dislike about PH is the freaking Temple of the Ocean King. Cool concept, poorly executed. I'm a big fan of being able to revisit dungeons, but this isn't quite what I had in mind. The dungeon is fun the first 2 or so times you go through it, every other time is just a boring ride through the same thing over and over and over and over again. The hourglass itself also makes the puzzles more frustrating than difficult, because you have to be extra careful not to get hit by a Phantom and lose precious time. I've never died inside it, but I've come close, and it was out of frustration more than difficulty. The Tower of Spirits in ST, however, is quite a bit different. It's the same kind of concept, but it was handled much better. Not having to tediously traverse through the same rooms every single time was a welcome change, as was the removal of the time limit, making the trips through the Tower of Spirits much nicer. I was able to go through them and figure out the puzzles at my own pace, and I didn't have to redo floors I had already completed. Being able to control Phantoms was also really awesome, and it opened up some really clever puzzles that I thought displayed far more innovation than any of the puzzles in the Temple of the Ocean King.
Having Zelda actually mean something in the story and be a complete character was pretty nice as well. In most of the other games, and PH especially, she's just kinda there for a few scenes, gets herself kidnapped, then gets rescued by Link at the end (in PH it was technically Tetra, but she's Zelda anyway). In ST, Zelda plays a pivotal role in the game, as she acts as Link's primary companion throughout it. It's the first time Zelda actually received a large role, and it's fantastic. She was a really helpful companion, somewhat of a rarity in the series (not helpful as in hints, but helpful as in actually helping Link solve puzzles and defeat enemies). It was nice to finally see her be her own character and get some development.
I should also give props to the music. The Spirit Flute (A panflute given to Link by Zelda near the beginning of the game) is symbolic of the sound Link's train makes, as the sounds it makes resemble a train whistle. As such, all of the Locomo songs sound like songs that a train car character might play. Building off of this, the game's entire soundtrack is structured around the flute, which is, as I said before, symbolic of the overall theme of the game. As the game revolves around the train, the music sounds like it does too. Of course, I'm not saying Phantom Hourglass didn't have good music, because it definitely did, but I like Spirit Tracks' soundtrack a lot more as, not only is it more catchy, but it fits the game better than that of Phantom Hourglass.
One thing I will say, though, is that the primary mode of transportation sucks in both games. They were cool on paper, admittedly bad in the actual game.
So, all in all, I can definitely say with absolute 100% certainty that I prefer Spirit Tracks over Phantom Hourglass. Not saying PH is a bad game of course, it is just overall inferior to its sequel.