There's a reason George Lucas and a lot of people around the mid 20th century used the phrases "science fantasy" or "space fantasy" rather than "sci-fi", though those phrases have gone out of vogue over the years. Space opera is still used quite often to describe a lot of the fiction you're probably thinking of though.
That said, science fiction is an actual genre and there are some differences between stories that fall within that bracket and fantasy of any stripe, mostly that genuine science fiction tends to start from a scientific theory or idea, building up the plot and characters to examine that conceit and how it would affect society rather than just making up whatever sounds good to support the plot and characters. The two are almost polar opposites in that way I suppose.
Asimov's robot stories are both a good example and probably the most famous example of sci-fi instead of fantasy, since he took the idea of robots that had been kicking around for a while, set some boundaries and then examined in a myriad of ways how the existence of robots would effect society and what it might mean for people. Corey Doctorow is a more recent author who tends to write science fiction, though he tends to concentrate on more near science fact than Asimov did with stories about 3D printing, copy right and so on. Not that their vision very often pans out to reality, and a lot of older stories seem more fantastic now because the scientific premises in them have been debunked, but they were scientific in their day. Jules Verne is a good example of that.