Existing analytical and semianalytical solutions for density-driven flow (DDF) in porous media are limited to 2-D domains. In this work, we develop a semianalytical solution using the Fourier Galerkin method to describe DDF induced by salinity gradients in a 3-D porous enclosure. The solution is constructed by deriving the vector potential form of the governing equations and changing variables to obtain periodic boundary conditions. Solving the 3-D spectral system of equations can be computationally challenging. To alleviate computations, we develop an efficient approach, based on reducing the number of primary unknowns and simplifying the nonlinear terms, which allows us to simplify and solve the problem using only salt concentration as primary unknown. Test cases dealing with different Rayleigh numbers are solved to analyze the solution and gain physical insight into 3-D DDF processes. In fact, the solution displays a 3-D convective cell (actually a vortex) that resembles the quarter of a torus, which would not be possible in 2-D. Results also show that 3-D effects become more important at high Rayleigh number. We compare the semianalytical solution to research (Transport of RadioACtive Elements in Subsurface) and industrial (COMSOL Multiphysics®) codes. We show cases (high Raleigh number) where the numerical solution suffers from numerical artifacts, which highlight the worthiness of our semianalytical solution for code verification and benchmarking. In this context, we propose quantitative indicators based on several metrics characterizing the fluid flow and mass transfer processes and we provide open access to the source code of the semianalytical solution and to the corresponding numerical models.