As many of you know it is important to know which genre your book falls into. (Even before it is written.) That is for successful marketing to your audience. No one sells a Halloween cook book in the fantasy aisle. The thin veil between fantasy and sci-fi can be confusing or even frustrating. But, its quite normal for stories to fall under both genres. Take my favorite movie for example, The Fifth Element!
This is arguably one of the oldest genres of writing history. Its elements include a world created under the author. Rules apply in these cases but it is within the writer's freedom. One can make creative ways to logically explain the conditions of their story. The word 'fantasy' shouldn't always entail the presence of dwarves and elves or wizards. Times have changed and originality is a rare gem these days. An example of this is in Avatar the Last Airbender (lets pretend there isn't a movie for it) - this story occurs in world far outside our own. But, it's also not some distant planet far away where space traveling Americans can exist.
It's exactly what the name is for, Science Fiction. This is a genre that contains elements that can be considered a possibility in the world as we know it. Not to say theses things are easily accomplished. If it includes theories relative to science such as time travel, space exploration, advanced human robots, and so on...then it qualifies as sci-fi. The rules in this genre may be a bit stricter due to making it sound possible to the reader.
It's not unusual to have stories that contain both and it can surely be debated, but all in all knowing if your book is fantasy, sci-fi, or both (if you're writing that kind) be sure you will be marketing toward the correct audience! Happy writing!