This year was a great one for science fiction and fantasy that transcended genre boundaries. Novels that appeared to be science fiction turned out to be fantasies, and stories that began as outer space battles turned into thought-provoking meditations on the political future of humanity. Not surprisingly, given that the past few years have been economically and politically tumultuous around the world, the science fiction and fantasy published this year were often about worlds in transition. Or worlds on the brink of collapse. Here are our picks for the very best science fiction and fantasy books of 2012.

Add your own choices in comments below.

2312, by Kim Stanley Robinson (Orbit)

A masterful space opera that combines a detective story with a romance, this is Utopian science fiction at its finest. Funny and intricate, the novel offers us an expansive look at the cultural powers that arise as humans geoengineer the solar system for human colonization. Or rather, as we bioengineer ourselves to become true space colonists. A mysterious person (or group) has bombed a city on Mercury, and as our characters race to find out who did it, they uncover a conspiracy — and a revolution that could finally liberate Earth from its polluted history. For its political acuity, hopeful but pragmatic vision of tomorrow, and thrilling scientific ideas, 2312 is undoubtedly one of the best books this year, or any year, in science fiction.

The Long Earth, by Terry Pratchett and Stephen Baxter (Harper)

This is a fascinating thought experiment in parallel world-building by two of the most beloved science fiction and fantasy writers of our day. A humble invention involving a potato allows people to begin hopping into alternate Earth timelines — and it turns out that humans exist in only one. But somehow, a few talented humans have managed to explore, and even colonize, these alternate Earths without the aid of the potato technology. Full of Pratchett's humor and Baxter's flair for science on a cosmic scale, this is a gripping story about what happens when humans discover that there are alternatives to our world.

Intrusion, by Ken MacLeod (Orbit)

MacLeod's latest sly political fable took the UK by storm with its story of an authoritarian health care system that pushes every woman to take "the fix," a pill that repairs all "genetic mutations" in her unborn children. Of course, it may be repairing beneficial mutations too. When a young couple refuse to take the fix, they learn how terrifying it is to defy the state — and in the process, they discover a strange genetic abnormality inherited from people who hail from the Scottish isles. This is MacLeod at his finest, mixing a well-observed political dystopia with the story of a family coming to grips with their traditional Scottish heritage. Available only in the UK, but you can order it through UK Amazon.

Alif the Unseen, by G. Willow Wilson (Grove)

Like Intrusion, Wilson's novel mixes a futuristic tale of an authoritarian state with fables from traditional cultures. Set in an unnamed city in the Middle East, the novel is about a young hacker, Alif, who helps political subversives post anonymously on the internet. Until one day he and his girlfriend manage to hack their way into a supernatural world, thanks to a book that connects ancient Arab writings to quantum computing. Now Alif is on the run from state authorities as well as demons, effrit, and other denizens of a magical world. Wilson has spent most of her adult life in Cairo, and her experiences there inform this story about the technologies that unite legends of the past with revolutions of the future.

The Killing Moon and The Shadowed Sun (Dreamblood Duology), by NK Jemisin (Orbit)

This year, Jemisin published both parts of this duology about the magic-infused city of Gujaareh, where people's dreams provide the raw materials for the benevolent spells that priests use to protect the city. But a series of deadly accidents lead Gujaareh's citizens to question the dream goddess' priests who have ruled them for so long. A story that begins as a tale of magic and evolves into a complicated story about enslavement, history, and urban life, this duology is Jemisin's finest work yet — destined to become a fantasy classic.

Wonders of the Invisible World, by Patricia McKillip (Tachyon)

The 16 stories in Wonders of the Invisible World span the past few decades, with the earliest dating from the mid-1980s. They also range from high fantasy, to urban fantasy, to fairy tales, to something approaching magical realism, with a couple of stories set in the future or on other planets. Each story is like a master class in drawing the reader into a setting and a group of characters, using humor and surprise and irony and weirdness to twist you around once you're already hooked. It's like a perfect encapsulation of fantasy writing at its most brave and beautiful.

Redshirts, by John Scalzi (Tor)

John Scalzi takes some of his trademark smart, quippy characters and puts them into a Trekkian reality in which they're forced to make sense of their existence. And as meta as you think Redshirts is going to be - it's actually much, much more meta than that. On one level, it really is like Tom Stoppard's Rosenkrantz and Guildenstern are Dead, in that you see what bit players get up to when they're not part of the "real" storyline. But it's also consciously about being trapped in someone else's heroic fantasy, and how destructive and horrible that actually is. It's rare that an author can move from meta humor to a wistful meditation on violence and death. But Scalzi succeeds here, and he does it in a way that will have you laughing, then thinking, for weeks after you put the book down.

Mr. Penumbra's 24-Hour Bookstore, by Robin Sloan (Farrar, Straus, and Giroux)

This novel is a trapdoor fantasy, which is to say it contains no actually fantastical events but is instead a long and loving meditation on fantasy novels and the ways they inspire us to do seemingly magical things in our everyday lives. A humble bookstore clerk discovers that the used books in his store are actually parts of a vast and ancient puzzle that a secret society has been trying to solve for hundreds of years. Using data visualization software, and borrowing some of his girlfriend's pals at Google, he begins to tackle this ancient mystery with modern tools — and some hints taken from a fantasy series that strongly resembles Anne McCaffrey's Dragonsong books. A novel that bridges the boundary between literature and fantasy, Mr. Penumbra's 24-Hour Bookstore is about how sometimes, nothing is more magical than rationality and ordinary human relationships.

vN, by Madeline Ashby (Angry Robot)

vN is a strange, dazzling look at the world through the eyes of a rogue artificial woman, who sees things in an off-kilter fashion, and becomes the most dangerous robot in the world as a result. You get drawn into Madeline Ashby's lush, disturbing world, seeing it through the eyes of a robot, and soon enough you're losing your whole sense of reality. The familiar human world will never look the same again. The story centers around what happens to robots who can circumvent the "fail safe" that prevents them from harming humans. Harrowing, dark, and occasionally uneven, this debut novel offers the kind of thought-provoking-yet-exciting stories about artificial creatures that only come along once in a while.

Throne of the Crescent Moon, by Saladin Ahmed (DAW)

Like the Dreamblood Duology, Throne of the Crescent Moon explores the intersection of magic and politics in a city that has been ruled by the same regime for centuries. A group of mismatched characters, each coping with personal problems, must prevent attacks from zombie-like creatures on their magnificent, Arabian city. At the same time, a charismatic thief leads a people's revolt to overthrow the city's aristocratic rulers. Full of humor and keenly-observed details, Ahmed's novel is like a cross between a story from One Thousand and One Nights and the politics of Arab Spring. Plus, the fight scenes are swashbuckling fun and the monsters are amazing. Come for the escapism, but stay for the smart storytelling.

The Dog Stars, by Peter Hiller (Knopf)

The Dog Stars is a literary novel that's as much a beautiful character study as it is a disturbing story of post-apocalypse. A mutated flu has wiped out 99 percent of the human race. And meanwhile, global climate change wipes out a lot of the wildlife, although there are still some animals around. The main character, Hig, lives in a deserted old McMansion, with just his dog and a survivalist named Bangley for company. Hig is also a pilot, who decides one day to seek out a small, remaining chunk of civilization he's heard broadcasting on the radio. Full of gorgeously-written passages and fascinating technical details about flying, The Dog Stars is about how nothing is what it seems, in both the crumbling real world and the complicated inner world of our emotional lives.

Read our picks for best books from previous years: 2011 | 2010 | 2009