SAN JOSE, Calif.—Apple Inc. won a small victory in its latest patent dispute with Samsung Electronics Co., but largely failed in its attempt to slow competitors to its landmark iPhone.

A federal-court jury ruled Friday that some Samsung devices infringed on two Apple software patents, but didn't infringe on two others; the judge had earlier ruled that Samsung infringed on a fifth patent.

The...