Speculative Fiction is popular fiction that contains fantastic elements or is set somewhere besides contemporary Earth is often called 'speculative fiction' (abbreviated 'sf' here).
Types of Sf
Sf includes both fantasy and science fiction, as well as anything in between. Sf includes many types of fiction.
Some examples are: high fantasy such as A Game of Thrones by George R. R. Martin; urban fantasy such as Memory and Dream by Charles de Lint; alternate history such as the Worldwarseries by Harry Turtledove; and hard science fiction such as A Fire Upon the Deep by Vernor Vinge.
It's not important to categorize sf this way. These categories overlap. For example, A Fire Upon the Deep is also space opera. Some books seem as if they were deliberately written just to flout these categories. The Iron Dragon's Daughter by Michael Swanwick contains tropes from almost every possible type of sf.
Warp-drive starships, magic rings. Wizard spells and dragon wings. Killer germs a space probe brings. Tropes are what you call such things.
Why are these special things called tropes? I do not know.
Past, Present, or Future?
To many people, sf means science fiction, and science fiction means futuristic space opera, or at least sci-fi movie images of futuristic technology in an extrapolated near-term future. Rocketships and robots. That kind of thing.
But sf can just as easily be set in an alternate past, or in an alternate present. Or just somewhere that doesn't exist.
Star Wars boasts a plethora of spaceships and aliens, but is set "a long time ago, in a galaxy far away."
Often sf settings are as important as the plot or characters. Hence, worldbuilding is a major part of sf writing.
Dune and The Lord of the Rings are two cardinal examples of world building. Both Frank Herbert's protracted story of a galactic jihad and Tolkien's quirky tale of a non-existent fantasy world could as easily take place in the distant past as the far future.
Fantasy or Science Fiction?
Sf tropes include technological advances beyond current scientific evidence and magical powers unknown to modern humans.
Arthur C. Clarke is among the top sf writers of all time. He once said, ''Any sufficiently advanced technology is indistinguishable from magic.'' So the great question of whether any particular book should be called science fiction or fantasy is meaningless anyway. Just call all of it speculative fiction and be done with it.
Within the sf community, the term 'sci-fi' generally refers to visual-media sf rather than written sf, and often has a negative connotation.