Which force acts opposite of the direction of displacement of the object?

I think it would be friction...but could it be spring?

Both are correct. Friction is opposite to the direction of motion or, in the case of static friction, an applied force that attempts to cause motion. A spring's force is opposite and proportional to the displacement from an equilibrium position.

If I had to choose one answer for a fill-in-the-blank question, I'd pick 'spring'