Aspirin and ibuprofen both belong to a class of medications known as the non steroidal anti inflammatory medications (NSAIDs). All NSAIDs have good anti inflammatory and anti pain effects, so both aspirin and ibuprofen will be effective in relieving pain and inflammation in your back.
The main difference between aspirin and ibuprofen has to do with their side effects and other usages. In particular, aspirin is a blood thinner (which is actually its most common usage) whereas ibuprofen is not. Also aspirin is more likely to cause irritation of the stomach lining than ibuprofen.
For most people with intermittent back pain, generally most primary care doctors will recommend ibuprofen over aspirin. This is not because aspirin will not work for the pain, but is rather because of the consideration of these side effects that I just mentioned.
If you continue to have back pain, you should see your primary care doctor
. There are additional things, other than taking pain medications, that you could do to improve your back pain, such as undergoing a course of physical therapy. Additionally there are back stretches and back strengthening exercises that you could perform at home to reduce the frequency of your attacks of back pain.