Pain in Middle Back

I have recently started getting a pain in my middle back when I do Squats and Deadlifts. When it first happened I was in pain for the next day, but now I only feel it when I do either of these exercises.
How should I go about dealing with this?

Is it just a matter of rest?