If you're employed and if the investments are funded out of income, then yes. If you're a gentleman of leisure and if your income is derived from (for instance) Dividends or CGT, then HMRC will look on that differently.
Main classifications of relevant earnings here:
RPSM05101150 - Technical pages: contributions and tax relief: member contributions: entitlement to tax relief: relevant UK earnings