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 a 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 way that refers to North Africans in Spain, without specifying (e.g. "I was in a shop and it was filled with moros"). The only safe use of the term today for people is to indicate ethnicity: "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.