From netdoctor:
Ibuprofen works by blocking the action of an enzyme in the body called cyclo-oxygenase (COX). In certain arthritic and rheumatic conditions, or if you have an injury, COX makes substances called prostaglandins. These cause pain, swelling and inflammation. When you apply ibuprofen to the skin, it stops the production of prostaglandins in the underlying tissues. This reduces inflammation and pain in the local area.
Ibuprofen is absorbed into the bloodstream less when you apply it to the skin than when you take it by mouth, which means gels and sprays are less likely to cause side effects than products you take by mouth. However, absorption can still occur, particularly if you use large amounts on large areas of skin.
I avoid oral ibuprofen as I have IBD (not IBS). A knee surgeon advised me against it for post-operative inflammation.
I find paracetamol combined with topical OTC Deep Freeze works well for temporary joint problems and back pain.