To find the amount spent on marketing that maximizes the profit \( P \), we can use the formula for the vertex of a quadratic equation. The given profit function is:
\[ P = -5x^2 + 1000x + 5000 \]
This is a quadratic equation in the form \( P = ax^2 + bx + c \), where \( a = -5 \), \( b = 1000 \), and \( c = 5000 \).
The x-coordinate of the vertex of a parabola described by the equation \( ax^2 + bx + c \) is given by the formula:
\[ x = -\frac{b}{2a} \]
Substituting the values of \( a \) and \( b \):
\[ x = -\frac{1000}{2 \times -5} = -\frac{1000}{-10} = 100 \]
Thus, the amount spent on marketing to achieve the maximum profit is \( \boxed{100} \) thousand dollars.