The dictionary definition is wrong.
"Muslim" is translated as "Musulmán", which means somebody belonging to a specific religion. "Moro" means somebody belonging to a specific race: those who invaded Iberian Peninsule and its descendants, part of the current non-bereber population of Morocco.
The expression "(No) haber moros en la costa" is in no way pejorative, and can be safely used both in positive and negative forms.
The use of the word "moro" by itself is not pejorative if used in an Historic way (e.g. if you are talking about the Almohade empire, the so-called Spanish Reconquest period or the Taifas), but it most probably is if you are using it today in a non-ethnic way (e.g. "I was in a shop and it was filled with moros"). Only safe usage about today people is the ethnic way: "La población marroquí actual se compone de dos ramas principales: moros y bereberes". Even this one could be received as pejorative by some, even while it is not.