Domain dependent. Sorry. No universal answer.
.
Expert means that you know something well, or are good at doing it. You may or may not be good at other things.
Specialist, really means that you specialise in that thing. You may or may not be good at it.
.
But, you are right. They tend to be used to mean close to the same thing,
A specialist is given the benefit of the doubt that he/she is also good at their specialisation.
.
When?
You are a specialist, when you have specialised on a topic/skill ...
YOu are an expert when you know more than a threshold amount about something, or demonstrate skill above some threshold.
.
I'm always a little sceptical of anyone who calls themselves an expert. It's too easy a term to use.
.
At school my maths book was called "Advanced maths". Early in university it was "intermediate" something. Later on it was "Elementary" something.
It seems the more you know about many things, the more you know of what you should know but don't.
My guess is that you are an expert when others call you that.
Hope this helps in some way. :)