Nearly every mention of Terraria (including this one) compares it to Minecraft, but that isn't the most appropriate comparison to make. Some people have made the link to the Metroidvania style with its exploration of a vast world, as you slowly build up your character's abilities to open new areas (a similar point could be made by pointing towards The Legend of Zelda, from where Terraria undoubtedly gets a lot of its aesthetic). This gets closer to the truth, but the world in Metroidvania games is static, and the ways in which you interact with it very limited. In Terraria, the world is procedurally generated to start off with, meaning that every game is different as various bits of the experience becomes more or less accessible depending on the whims of the Random Number God. Most importantly, as you carve away at the landscape, expand your home base, and tame the underground, the character of the world changes in very meaningful ways. No, the most important comparison to be made is with the roguelikes: Nethack, Angband, Ancient Domains of Mystery, and especially more polished ones like Pokémon Mystery Dungeon.
The process where you slowly collect a range of items in preparation for endgame play, where tools are at least as important as weapons and armour, reminds me of nothing as much as compiling an Ascension Kit in Nethack. Of course, Terraria isn't anywhere near as dense (it's a side-scroller instead of a pile of large top-down layers) and is far more forgiving (in a classic rogue-like, death is permanent, in Terraria, you drop half of your cash and respawn after a few seconds), and it works in real-time. But, in classic style, your progress is measured by how deep you've gotten and how many of the necessary tools you've collected. It even references that grand old master of rogue-like off-shoots, Diablo, by having loot colour-coded for rarity. I don't hesitate to call this is a friendly real-time side-scrolling rogue-like with a Minecraft-like crafting mechanic added.
Ultimately, the game Terraria is closest to is Dwarf Fortress, which is a roguelike-turned-city-builder. One important difference - looking past the obvious ones that in Dwarf Fortress you rarely control a single character, and that Terraria has graphics and music - is that Dwarf Fortress is extreme in its detail and challenge, whereas Terraria is easy-going and cheerful. It can't compare to the depth of Dwarf Fortress - nothing can, it is possibly the deepest game ever made, and it's still only at version 0.31.25 - but Dwarf Fortress is uncompromising, and each of its dozens of game features means there's a new way for everything to go wrong. Not for nothing is the Dwarf Fortress motto "Losing is Fun". Whereas in Terraria, as in Minecraft, building is fun, and Terraria does an excellent job of combining that motivation to keep going with that most classic gameplay arc: go further, get more stuff, hit bigger enemies with your new stuff, repeat. This helps account for the fact that the game's creators refers to it as an action-adventure game, though the combat is very rudimentary and the aspect everybody has latched on is its similarity to the decidedly non-action-driven Minecraft.
On the action side of things, Terraria can't compete with the complexity of Nethack, with its hundreds of different monsters and dozens of magical status effects, or even with less intimidating fare like Diablo or any of its clones. But the crafting here is much more intricate and rewarding, and that comes straight out of Minecraft. That is what Terraria uses to set itself aside from the pack, making use of the valuable lesson Minecraft has taught us that it is one humdinger of a motivation to play a game when you are able to meaningfully shape the world through your own work. And it's a great game. I've put in over 20 hours in a small world, and have yet to open the two deepest environments. For a small downloadable game to offer this much is quite an achievement, and I heartily recommend it to all comers. The only criticism I can offer is the issue which besets many games of the sandbox type: the experience can be very undirected, and once you're about halfway in it can become hard to stay focussed, or to know what you should be doing. This very much comes with the territory, but it's a testament to Terraria how long it manages to stave off this particular worry, and how rewarding it is to keep playing. Every time thus far my interest has started to flag, I discovered something new: a floating island high in the sky, or the entrance to a dungeon eerily suggestive of what your own handiwork would end up like if, instead of you clearing the world, the world were to get rid of you. It's in the Dungeon that the comparison with Dwarf Fortress becomes the easiest to make. Terraria is in spirit a very different type of game to the roguelikes which undoubtedly influenced it, having re-packaged their ever-deeper-into-the-darkness gameplay in an inviting and cheerful manner, but it benefits from their depth, and presents it in a way that is undoubtedly fun. You should try it out.