You can do it with caption package. The space between the caption and the figure is called skip (default is 10pt).
\documentclass{article}
\usepackage[demo]{graphicx} %% Remove [demo] in your file
%\usepackage{caption}
%\captionsetup[table]{font=small,skip=0pt} %% Adjust here
%or equivalently
\usepackage[font=small,skip=0pt]{caption}
\begin{document}
Some text...
\begin{figure}[htb]
\begin{center}
\includegraphics[height=1in,width=1in,angle=-90]{foo}
\caption{This is a figure.}
\end{center}
\end{figure}
More text...
\begin{table}[htb]
\centering
\caption{This is a table.}
\begin{tabular}{|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
1 & 2 \\
4 & 7 \\
\hline
\end{tabular}
\end{table}
More text...
\end{document}

Please note that \captionsetup{font=small,skip=0pt} affects both tables and figures. If you want it separately, you may use:
\captionsetup[table]{font=small,skip=0pt}
for tables only or
\captionsetup[figure]{font=small,skip=0pt}
for figures only.
:)Making mine better is out of the question since it will look like a duplicate of your answer. +1 anyway. – hpesoj626 Jan 16 '13 at 05:10:-)– Jan 16 '13 at 05:15\captionsetup[table]{}and\captionsetup[figure]{}separately. – hpesoj626 Jan 16 '13 at 06:52\captionsetup[figure]{skip=0pt}inside\begin{figure}(just after\begin{figure}say), then it is local. – May 07 '14 at 08:59\begin{figure}[htb] \captionsetup{font=small,skip=0pt} \centering \includegraphics[height=1in,width=1in,angle=-90]{foo} \caption{This is a figure.} \end{figure}works for me. – May 07 '14 at 09:32skipto subcaption package – Cyriac Antony Aug 08 '19 at 11:44\captionsetup[table]{..., aboveskip=0pt, belowskip=0pt}works. They accept negative values as well. – Jovial Joe Jayarson Nov 21 '23 at 02:52