To find the value of \( x \) that maximizes the profit \( P = -5x^2 + 1000x + 5000 \), we can use the vertex formula for a quadratic equation of the form \( ax^2 + bx + c \). The \( x \)-coordinate of the vertex (which gives us the maximum profit since the parabola opens downward) can be calculated using the formula:
\[ x = -\frac{b}{2a} \]
In the given equation, \( a = -5 \) and \( b = 1000 \).
Substituting these values into the vertex formula, we get:
\[ x = -\frac{1000}{2(-5)} = -\frac{1000}{-10} = 100 \]
Thus, the amount to be spent on marketing to achieve maximum profit is \( \boxed{100} \) (in thousands of dollars).