A lucky guess that turns out true is not knowledge. Something has to be added.
Knowledge is not simply true belief. Someone who guesses correctly on a coin flip, with no basis for the guess, ends up with a true belief, but no one would call that knowledge.
The classical answer, tracing to Plato’s Theaetetus, is the tripartite or “justified true belief” analysis: a person knows a claim only if the claim is true, the person believes it, and the belief is adequately justified rather than merely accidental. Each condition does separate work. Truth rules out knowing something false, however sincerely held. Belief rules out knowing something you do not actually accept. Justification is the condition that rules out lucky guesses, the belief has to be properly grounded, not just correct.
This definition is nearly universally treated as necessary but not sufficient, famous counterexamples show a belief can be true, believed, and justified while still missing something knowledge requires. That further complication belongs to the study of epistemology itself; this entry stops at the structure knowledge is built from, not the argument about whether that structure is complete.
Source: Stanford Encyclopedia of Philosophy, “The Analysis of Knowledge.”