My understand is that if the story is, at its heart, about the development of a romantic relationship, and that relationship is in a happy place by the end, then the story is a romance even if most of the "action" in the story is sex.
See the
Is my book a romance? Flow chart.
Love the chart, though "central to the story" is the hard part for me. How central? I take it to mean that there really wouldn't be a story without the romance, as it's the main conflict and plot-driving element, or that the plot would at least be
really different without the romance between the two central characters. Yet I've read plenty of romances where there's a distinct problem that one or both protagonists has--being accused of a crime, regaining the family fortune, being accepted into high society, being recognized for one's accomplishment, saving the ranch--hiding one's true identity etc--that could certainly be a story without the romance (or sex). But with a romance, the relationship between the two characters tends to be central to the problem's ultimate resolution.
I've been told that with erotica, the sexual journey is central to the plot (and a romance may be tangled up with that, of course) and part of the resolution of the protagonists' problems.
There are romances that aren't remotely erotic (even entirely chaste), and there is definitely erotica that isn't a romance, or even terribly romantic (just about the sex, not loving emotions). But there are books that are both, too. I'm not sure where, exactly, the line is drawn about where to shelve or categorize the book in these cases (is it an erotic romance vs a work of erotica with romantic elements).
However, I have a similar issue with deciding whether a book is a fantasy novel with a very important romantic arc vs a romance set in a fantasy world.