  Let $f:A \rightarrow 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$, a construction that provides a general frame for studying the
amalgamated duplication of a ring along an ideal, introduced 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 amalgamation and, when it is a local
Noetherian ring, we study its embedding dimension and when it turns to be a
Cohen-Macaulay ring or a Gorenstein ring.
