To find the amount spent on marketing that maximizes the profit \( P \), we need to analyze the quadratic function given by:
\[ P = -5x^2 + 1000x + 5000 \]
This is a quadratic equation in the form of \( ax^2 + bx + c \), where:
- \( a = -5 \)
- \( b = 1000 \)
- \( c = 5000 \)
For a quadratic function \( ax^2 + bx + c \) with \( a < 0 \), the maximum value occurs at the vertex, which can be found using the formula \( x = -\frac{b}{2a} \).
Plugging in our values for \( a \) and \( b \):
\[ x = -\frac{1000}{2 \times -5} = -\frac{1000}{-10} = \frac{1000}{10} = 100 \]
So, the amount spent on marketing to achieve the maximum profit is \( 100 \) (in thousands of dollars).
Thus, the answer is:
\[ \boxed{100} \]