Get spectrogram matrix without specgram in MatLab
Yes, the easiest way to do this is using reshape and FFT, since reshape will give you a matrix and the FFT will operate along a dimension of the matrix. I've applied a 1024 rectangular window on a data set of 65536 points, sampling frequency Fs (1024), and signal frequency (100).

x = randn(1, 65536) + cos(2*pi*100/1024*(0:65536-1));
z = reshape(x, 1024, []);
y = 20*log10(abs(fft(z)));
imagesc(y)


This example doesn't have any overlap, but all you would need to do is shift z then concatenate it with z prior to taking the FFT. This all depends on your overlap percentage.

z = [z; circhift(z, [0 -1])];


This is not complete given the first column is now at the end, so you would have to omit that column, but you get the idea.