  We derive the Bekenstein-Hawking entropy for a class of BPS black holes in
the massive type IIA supergravity background AdS$_4 \times S^6$ from a
microscopic counting of supersymmetric ground states in a holographically dual
field theory. The counting is performed by evaluating the topologically twisted
index of three-dimensional $\mathcal{N}=2$ Chern-Simons-matter gauge theories
in the large $N$ limit. The $\mathcal{I}$-extremization principle is shown to
match the attractor mechanism for the near-horizon geometries constructed in
the four-dimensional dyonic $\mathcal{N}=2$ gauged supergravity, that arises as
a consistent truncation of massive type IIA supergravity on $S^6$. In
particular, our results prove that the imaginary part of the three-dimensional
partition functions plays a crucial r\^ole in holography.
