Let $f:A \to B$ be a ring homomorphism and let $J$ be an ideal of $B$. In
this paper, we study the amalgamation of $A$ with $B$ along $J$ with respect to
$f$ (denoted by ${A\Join^fJ}$), a construction that provides a general frame
for studying the amalgamated duplication of a ring along an ideal, introduced
and studied by D'Anna and Fontana in 2007, and other classical constructions
(such as the $A+ XB[X]$, the $A+ XB[[X]]$ and the $D+M$ constructions). In
particular, we completely describe the prime spectrum of the amalgamated
duplication and we give bounds for its Krull dimension.