Yet, throughout most of the artists’ lives, until 1648 — when both men were in their late 40s — the two countries were engaged in the Eighty Years’ War, the Netherlands’ struggle for independence from Spain. The northern provinces of the former Hapsburg Monarchy revolted against Roman Catholic rule, seeking to establish an independent Protestant state that eventually became the Dutch Republic.

War made travel difficult, so Spanish and Dutch artists rarely met, even if their artworks were circulated, most often in the form of portable prints. It’s almost certain that Rembrandt and Velázquez never encountered each other; Velázquez may have seen some of Rembrandt’s etchings, and Rembrandt may have heard that there was a master painter in Madrid, said Gregor Weber, the curator of the Rijksmuseum exhibition. But they are not known to have corresponded, he added.

Nevertheless, their work bears a surprising resemblance. Both specialized in portraiture, capturing the prominent figures in their respective countries; for Velázquez, this meant the Spanish royal family; for Rembrandt, wealthy Dutch burghers and merchants. They both painted in contrasting dark and light hues, favoring palettes of darker, earthy pigments: bone black, ocher, umber, siennas and lead white.

“They meet in their intentions: how to paint, why to paint and what to paint,” Mr. Weber said in an interview. “The intention of both was always to go deeper into the psychology of their sitters. To be closer to reality, to be closer to religion, and to be closer, in general to the human condition.”