I would proceed as follows:
idx = find(freq>=4 & freq<=6);
trapz(freq(idx),spectrum(idx))
If I understood your question right, what stated above should lead you to the results you wanna estimate.
EDIT
Since you don't have spectrum values for freq=4Hz
and freq=6Hz
, I would suggest to interpolate values like this:
int_spec = exp(interp1(log(freq),log(spec),log(4:.1:6),'linear','extrap'))
and then call
trapz(4:.1:6,int_spec)